Hibernate--Xxx.hbm.xml ORM metadata Table Object Relational mapping file

Source: Internet
Author: User
Tags joins

<?XML version= "1.0" encoding= "UTF-8"?><!DOCTYPE hibernate-mapping Public "-//hibernate/hibernate mapping DTD 3.0//en" "Http://www.hibernate.org/dtd/hib Ernate-mapping-3.0.dtd ">    <!--ORM Metadata Table Object Relational mapping file package: Configure the packages in the configuration file that are in the same class.  - <hibernate-mapping Package= "Com.itheima.a_hello" >       <!--class--Configuring entity-to-table relationships name: Fill in the full class name of the entity table: the name of the entity counterpart Dynamic-insert: Dynamic Insert default value is False true=> If the field value is NULL, do not participate in the INSERT statement dynamic-update: Dynamic update Default value "False" true=> not Changed properties will not be generated into the UPDATE statement -     <classname= "User"Table= "T_user"  >

<!--id--configuration entity and the ID in the table the attribute name that identifies the primary key in the Name:user object column: The columns name of the primary key in the table length: The data length of the column Unsaved-value (infrequently used): Specifies why a primary key is treated as NULL when the value is specified. Access (not recommended): field then when manipulating properties, the corresponding field is manipulated directly instead of the Get/set method - <IDname= "id"column= "id"length= "255" >


<!--Generator-primary key generation strategy The 1.increment database generates its own primary key. First query the maximum ID value from the database, add the ID value 1 as the new primary key 2.iden Tity relies on the data's primary key auto-increment function 3.sequence sequence, which relies on the sequence function (Oracle) in the data. 4.hilo (pure Understanding, never used): Hibernate to implement the sequence of the algorithm itself, generate the primary key. (Hilo algorithm) 5.native automatically according to the database judgment, three select one. Identity|sequence|hilo 6.uuid generates a 32-bit non-repeating random string as the primary key 7.assigned itself specifying the primary key value. Used when the primary key of a table is a natural primary key. - <Generatorclass= "UUID"></Generator> </ID>

<!--Property-The attribute in the entity corresponds to the column in the table name: attribute name in entity column: Name of column in table length: Data length Precision: Precision scale After decimal point: number of significant digits insert (not normally used): whether the property joins the INSERT statement. Update (not normally used): whether this property joins the UPDATE statement. Not-null: Specifies whether the constraint of a property uses a non-null unique: Specifies whether the constraint of the specified property uses a unique - <!--type: Expression of this property can be specified in three ways properties Java type Database type specify Hibernate class TYPE specifies java.lang.String varchar String - < Propertyname= "Name"column= "Name"Update= "true"type= "string" ></ Property> < Propertyname= "Password"column= "Password"></ Property> < Propertyname= "Sal"column= "Sal"Precision= "2" Scale= "3" ></ Property> </class> </hibernate-mapping>

Hibernate--Xxx.hbm.xml ORM metadata Table Object Relational mapping file

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.