The JPA specification supports 4 different primary key generation strategies which generate the primary key values programmatically or use database features, like auto-incremented columns or sequences.
1. GenerationType.AUTO - The GenerationType.AUTO is the default generation type and lets the persistence provider choose the generation strategy.
2. GenerationType.IDENTITY - The GenerationType.IDENTITY is the easiest to use but not the best one from a performance point of view.
3. GenerationType.SEQUENCE - The GenerationType.SEQUENCE is to generates primary key values and uses a database sequence to generate unique values.
4. GenerationType.TABLE - The GenerationType.TABLE gets only rarely used nowadays. It simulates a sequence by storing and updating its current value in a database table which requires the use of pessimistic locks which put all transactions into sequential order.