The OID of Hibernate

Source: Internet
Author: User
Tags map class

1: Optimization for hibernate auto-generation, and high-low bit algorithm in OID.

<?xml version= "1.0" encoding= "UTF-8"?>
<!--DTD file on: HIBERNATE3.JAR\ORG\HIBERNATE\HIBERNATE-MAPPING-3.0.DTD-
<! DOCTYPE hibernate-mapping Public
"-//hibernate/hibernate Mapping DTD 3.0//en"
"Http://www.hibernate.org/dtd/hibernate-mapping-3.0.dtd" >

<!--dynamic-update= "true" to change the SQL statement to only the updated field. -
<class name= "Com.anrongtec.domain.Person" table= "PERSONS" ><!--mutable= all fields in the "false" class will not be updated. -
<!--map the primary key--
<!--<id name= "id" column= "id" type= "int" length= "one" >
Primary key generation strategy: For the moment, remember to use native
<generator class= "native" ></generator>
The OID allows hibernate to control.
</id>

<id name= "id" column= "id" type= "int" length= "one" >
<!--PRIMARY key generation strategy: For the moment, remember to use native--
<generator class= "Hilo" ><!--high and low bit generation strategy--
<!--designated Storage low
<param name= "Table" >tt</param>
<!--Specify a field that holds low values--
<param name= "column"->value</param>
<!--the largest low value--
<param name= "Max_lo" >5</param>
</generator>
</id>

<!--the relationship between attributes in a map class and database table fields--
<property name= "name" insert= "false" column= "name" ></property>
<property name= "Birthday" column= "Birthday" ></property>
<property name= "Address" column= "Address" ></property>
</class>

What the OID in 2:hibernate is, and how to configure it.

Hibernate's object identifier (OID)
You can use the <id> element to set the oid,oid can be defined as the Short,int,long type, and by default, hibernate will define the OID as the Java wrapper type when the persistence class is generated
Use the <generator> child element in the ID element to set the identifier generator, for example:
<id type= "Long" column= "id" >
<generator/>
</id>
The following is a built-in identifier generator provided by Hibernate:
1.increment
2.identity
3.sequence
4.hilo
5.native
6.uuid
7.assigned

The OID of Hibernate

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.