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>
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.