1 <?XML version= "1.0"?> 2 <!DOCTYPE hibernate-mapping Public3 "-//hibernate/hibernate Mapping DTD 3.0//en"4 "Http://www.hibernate.org/dtd/hibernate-mapping-3.0.dtd"> 5 6 <!-- 7 8 default-cascade= "None": Default cascading style, table linkage with table. 9 default-lazy= "true": Default lazy LoadTen - One <hibernate-mapping> A - <!-- - <class>: Use the class element to define a persisted class. the name= "Cn.javass.user.vo.UserModel": the Java fully qualified name of the persisted class; - table= "tbl_user": corresponding database table name; - mutable= "true": The default is true, which is set to False when the application cannot be updated or deleted; - dynamic-insert= "false": The default is False, dynamically modifying those fields that have changed, without having to modify all the fields; + dynamic-update= "false": The default is False, dynamically inserting a non-null value field; - select-before-update= "false": The default is False, before the modification of the first query, and the user's value is compared, there will be changes are really updated; + optimistic-lock= "version": Default to Version (check Version/timestamp field), Value: All (check all fields), dirty (check only modified fields) , A None (does not use optimistic locking), this parameter is mainly used to handle concurrency, each value has a fixed and unique version, the version is the latest to perform operations; at - - <classname= "Cn.javass.user.vo.UserModel"Table= "Tbl_user"Dynamic-insert= "true"dynamic-update= "true"Optimistic-lock= "Version"> - - <!-- - <id>: Defines the mapping of this property to the primary key field of the database table. - name= "UserId": the name of the identity attribute; in column= "UserId": The name of the table primary key field, if not filled with name; - - to <IDname= "UserId"> + <!--<generator>: Specifies what the primary key is generated from, the recommended use of uuid,assigned refers to the user manually fill in. - - <Generatorclass= "UUID"/> the </ID> * $ <!-- Panax Notoginseng <version/>: Use version control to handle concurrency, to turn on optimistic-lock= "version" and dynamic-update= "true". - name= "Version": the property name of the persisted class, column= "version": Specifies the name of the field that holds the version number; the - + <versionname= "Version"column= "Version"/> A the <!-- + <property>: Defines a persisted JavaBean-style attribute for a class. - name= "name": the name of the identity attribute, beginning with a lowercase letter; $ column= "name": The name of the table primary key field, if not filled with name; $ update= "true"/insert= "true": The default is true, indicating that it can be updated or inserted; - - - < Propertyname= "Name"column= "Name" /> the < Propertyname= "Sex"column= "Sex"/> - < Propertyname= "Age"column= "Age"/> Wuyi the <!-- - Component Mapping: Package multiple attributes together when an attribute is used, it is used to make the class less granular. Wu <component name= "attribute, here refers to Object" > - <property name= "name1" ></property> About <property name= "name2" ></property> $ </component> - - - - <!-- A <join>: An object maps multiple tables, which must be placed after all <property>. + <join table= "Tbl_test: Sub-table name" > the <key column= "UUID: Child table primary Key" ></key> - <property name= "name1: Object Properties" column= "Name: Child table field" ></property> $ </join> the - the the </class> the - </hibernate-mapping>
Entity-to-table mapping relationship XXX.hbm.xml configuration details (RPM)