I am having a constraint violation issue with Hibernate and the constraint is related primary key. I debugged a bit and see that the before insertion, sequence value selection as below
select table_seq.nextval from dual;
runs only at the beginning for the related table. Following the first sequence fetching, the rest utilized by hibernate manually. I mean if the selected sequence is 25 on the first insertion. Rest of the sequences generated automatically by hibernate itself. No more sequence selection triggered. This causes some weird issues like, app runs on two different servers crashes due to primary key constraint.
I found below, but not sure if I am hitting to the same wall. Issue with Hibernate @SequenceGenerator in Spring 3 application
p.s : I am trying to upgrade the app from hibernate 3.x to 5.2.12.