I am developing a spring 3 MVC application. I am using hibernate as the ORM. While defining the model, i have an ID field. I want to auto generate it in such a way that its value is the current number of rows in the table + 1. How can it be done?
Share
AUTOINCREMENTcolumn or a sequence will do the trick. In Hibernate simply annotateidwith@GeneratedValue:Hibernate will automatically set the id to next available value.
See also