The default sequence generator of JPA (SequenceHiloGenerator with allocationSize=50 ) generates a sequence value which is different from the corresponding oracle sequence's nextVal.
We have used allocationSize=50 for performance improvement but this creates problem by generating values which are not matching with the corresponding sequence values. In my case if nextVal of the sequence is 250 then the value generated by the JPA is far more than 250. I want the generator behaviour to return database sequence values while giving me performance enhancement by calling database sequence only once for every 50 inserts.
I know setting allocationSize=1 would generate value same as database sequence nextVal but in this case it makes select query for each insert to the table. I want to get rid of the selects for the inserts and thats why I moved on approach for HiliGenerator using allocationSize=50 but in this case facing problem of generated value not having in sync with the database sequence.
I would appreciate if anyone suggest a solution for this problem.