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).