[hibernate-dev] JPA's allocationSize & SequenceHiLoGenerator

Alexander Snaps alex.snaps at gmail.com
Fri Nov 23 06:14:30 EST 2007

I would like to get some feedback on the SequenceHiLoGenerator impl.
being used when specifying a value larger than 1 to the allocationSize
parameter of the @SequenceGenerator annotation.

I am indeed wondering why it isn't simply incrementing the
sequence.nextval by one until it has consumed all values until
sequence.nextval + allocationSize...

The reason is two folded:
1/ Why would I want to fall back to such large row ids?
2/ What if some other system is accessing the sequence to insert row
in the same table and eventually leads to duplicated values?

Is there actually a good reason to use the HiLo algorithm to implement
that feature and not the "simple way"? Am I missing something?

Alexander Snaps

More information about the hibernate-dev mailing list