Hibernate

Source: Internet
Author: User

Problems with primary key configuration

In Hibernate, the primary key of a data model is commonly used in three forms: UUID, native, assigned, respectively, universal unique identity, self-increment, and custom.
1, the UUID is the system generated, insert the database is much faster than native, but the UUID is a long list of unordered strings, in theory, it will be slower to find, but it will not affect the development. While native is a database generation, it is computationally slower than the UUID when you insert it, but it is easier to find and delete data.
2, UUID and assigned generation is done in the program, one is automatic, one is manual. Therefore, when Session.save () is performed, no SQL statements are generated and no data is available in the database. The native needs to read the database data to complete the auto-increment, so when the Session.save () is executed, the corresponding SQL statement will be generated, the database will have the data (the cache ID is a value).

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.