Aslam Khatri [
https://community.jboss.org/people/aslamk] created the discussion
"JPA Sequence generated value is different from Oracle sequence nextVal"
To view the discussion, visit:
https://community.jboss.org/message/734231#734231
--------------------------------------------------------------
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.
Regards
--------------------------------------------------------------
Reply to this message by going to Community
[
https://community.jboss.org/message/734231#734231]
Start a new discussion in EJB3 at Community
[
https://community.jboss.org/choose-container!input.jspa?contentType=1&...]