I wanted to set auto increment id while sending data to the database.
I can do so by using annotations @Id
and @generatedvalue
. But I don't want that to use annotations.
Are there other ways to do achieve this?
I wanted to set auto increment id while sending data to the database.
I can do so by using annotations @Id
and @generatedvalue
. But I don't want that to use annotations.
Are there other ways to do achieve this?
You can define a sequence in your database and xml config define it as
<id name="id" type="java.lang.Long" column="id">
<generator class="sequence">
<param name="sequence">tracks_seq</param>
</generator>
</id>
<id name="employeeId" column="EMPLOYEE_ID">
<generator class="increment"/>
</id>