Hibernate (Java) Question:

How do you define sequence generated primary key in hibernate?

Tweet Share WhatsApp

Answer:

Using <generator> tag.
Example:-
<id column=”USER_ID” name=”id” type=”java.lang.Long”>
<generator class=”sequence”>
<param name=”table”>SEQUENCE_NAME</param>
<generator>
</id>

Download Hibernate PDF Read All 52 Hibernate Questions
Previous QuestionNext Question
What is the difference between and merge and update?Define cascade and inverse option in one-many mapping?