Hibernate (Java) Question:
How do you define sequence generated primary key in hibernate?
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>
Example:-
<id column=”USER_ID” name=”id” type=”java.lang.Long”>
<generator class=”sequence”>
<param name=”table”>SEQUENCE_NAME</param>
<generator>
</id>
Previous Question | Next Question |
What is the difference between and merge and update? | Define cascade and inverse option in one-many mapping? |