Generator sub-element defines the generation policy of persistence flag

Source: Internet
Author: User

1. increment (incremental)

The unique identifier generated for long, short, or Int type. It can be used only when data is inserted in the same table of no other process network.

 

2. Identity

Supports the built-in Flag Fields of DB2, MySQL, MS sqlserver, Sybase, and returns the long, short, or Int type.

 

3. Native (local)

Select the current identity and Sequence Based on the capabilities of the formation Database

 

4. Assigned

ApplyProgramAssign an identifier to the object before saving ().

 

Differences between increment and identity

 

The increment method is incremental identifier implemented by hibernate. Each increment is 1.

The identity method relies on the auto-increment primary key generation mechanism of the underlying database. Each increment can be controlled in the database.

 

You can select native if you are not sure about identity, sequence, and increment.

 

Assigned mode. This mode can be used when the database uses a user-defined single primary key.

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.