How to generate JPA entity identifier values using a database sequence
Introduction In this article, I’m going to show you how you can generate entity identifier values using a database sequence when using JPA and Hibernate. Using a database sequence is the most efficient Hibernate identifier generation strategy, as it allows you to take advantage of the automatic JDBC batching mechanism.