JPA and PostgreSQL with GenerationType.IDENTITY
If you have a column of type SERIAL, it will be sufficient to annotate your id field with: @Id @GeneratedValue(strategy=GenerationType.IDENTITY) This is telling Hibernate that the database will be looking after the generation of the id column. How the database implements the auto-generation is vendor specific and can be considered “transparent” to Hibernate. Hibernate just … Read more