The initial problem was solved by wrapping the
tag at the right place (it was displaced before). However, EntityHome now persists always with s primary key beginning with 1, irrespective of whether there is data present or not. I double checked the sequence (I have same sequence number for all the tables) using
SELECT hibernate_sequence.NEXTVAL FROM dual;
the value was 21.
I'm generating the schema completely with hbm.ddl.auto and the default sequence generator is same for all the tables ( no max limit)
PS: If there is no data, it does work though.(with pk 1,2,3 etc ..)
Can you post the annotations you are using on the primary key field?
I dont have the code handy rt now, but it's something like this:-
@Id @GeneratedValue(strategy=GenerationType.SEQUENCE) private long id;
all our entity classes extend a BaseEntity class which has a version, id and some audit columns.
I've used similar annotations before, but using hibernate annotations. Didn't have a problem them. I'm guessing that running scripts (import.sql in classpath) via hbm.ddl.auto won't increment the sequence correctly.
I have tried with GenerationType.AUTO as well and I manually updated the sequence number in the database too, the problem persists -- it always saves with pk
1, to begin with.
Any help, appreciated.