标签:
<?xml version="1.0"?> <!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN" "http://www.hibernate.org/dtd/hibernate-mapping-3.0.dtd"> <hibernate-mapping package="com.fengye.hibernate"> <!-- class: 表示 实体类和表的映射 与数据库的相关设置不能出现数据库中的关键字 dynamic-update:更新的sql语句不包含空值.动态组织sql语句 dynamic-insert:插入式时不包含空的属性列,用于动态组织sql语句 select-before-update:在更新时先查询 --> <class name="com.fengye.hibernate.basic.BasicMap" table="BASIC_MAP" dynamic-update="true" dynamic-insert="true" select-before-update="true"> <id name="id" type="java.lang.Integer"> <column name="ID"/> <!-- 指定主键的生成方式, native: 使用数据库本地方式 --> <generator class="native"/> <!-- hilo --> <!-- <generator class="hilo"> <param name="table">HI_TABLE</param> <param name="column">NEXT_VAL</param> <param name="max_lo">10</param> </generator> --> </id> <!-- 普通属性 - property --> <property name="title" type="java.lang.String" column="TITLE"> </property> <property name="author" type="java.lang.String" index="news_index"> <column name="AUTHOR"/> </property> <!-- 时间(年/月/日,具体时间)--> <property name="date" type="date"/> <property name="time" type="time"/> <property name="timestamp" type="timestamp"/> <!-- boolean --> <property name="isUsed" type="yes_no"> <column name="isUsed" sql-type="varchar(1)"></column> </property> <!-- enum --> <property name="gender"> <column name="gender"> </column> <type name="org.hibernate.type.EnumType"> <param name="enumClass">com.fengye.hibernate.basic.Gender</param> <param name="type">12</param> </type> </property> <property name="desc" formula="(SELECT concat(author, ‘: ‘, title) FROM BASIC_MAP n WHERE n.id = id)"/> <!-- 大文本--> <property name="content"> <column name="content" sql-type="mediumtext"/> </property> <property name="image"> <column name="IMAGE" sql-type="mediumblob"></column> </property> <!-- component--> <component name="component" class="com.fengye.hibernate.basic.Component"> <parent name="map"/> <property name="component1" column="component1"/> <property name="component2" column="component2"/> </component> </class> </hibernate-mapping>
标签:
原文地址:http://www.cnblogs.com/fengyexjtu/p/5123074.html