What is the difference between these two Automatic value generation strategies?
1. @GeneratedValue
2. @GeneratedValue(strategy=IDENTITY)
This is like following:
AUTO Indicates that the persistence provider should pick an appropriate strategy for the particular database.
IDENTITY Indicates that the persistence provider must assign primary keys for the entity using database identity column.
SEQUENCE Indicates that the persistence provider must assign primary keys for the entity using database sequence column.
TABLE Indicates that the persistence provider must assign primary keys for the entity using an underlying database table to ensure uniqueness.
Refer to the API here http://docs.oracle.com/javaee/5/api/javax/persistence/GenerationType.html
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With