We can use the primary key generation strategy of type
GenerationType.AUTO to auto-generate primary key while
persisting an object in Hibernate.
Egg.
@Id
@GeneratedValue(strategy=GenerationType.AUTO)
private int id;
We can leave it null/0 while persisting and Hibernate automatically
generates a primary key for us.
Sometimes, AUTO strategy refers to a SEQUENCE instead of an
IDENTITY