Google News
logo
JPA - Interview Questions
Explain various types of identifier generation?
Following are various types of id generation strategy required to specify with @GeneratedValue annotation :
 
Automatic Id generation : In this instance, the application doesn’t require any id generation and can hand over this task to the provider. If any value is not specified explicitly, the generation type defaults to auto.

Id generation using a table : The identifiers generates by using a database table.

Id generation using a database sequence : Databases support an internal mechanism for generating an id that is called sequences. To customize the database sequence name, we can use the JPA @SequenceGenerator annotation.

Id generation using a database identity : To generate identifiers for the object, every row is inserted into the table, and a unique identifier is assigned. 
Advertisement