When using the seqhilo algorithm (hibernate 2.1.1) with a max_lo of 1000, I end up with an id skip every 1000 inserted rows.
For example, the following ids were
skipped in one of our tables:
720722, 721723, 722724, 723725, 724726, ....
I think this gap is due to the use of (maxLo +1) in the seq hilo generator code:
Code:
if ( lo>maxLo ) {
long hival = ( (Number) super.generate(session, obj) ).longValue();
lo = 1;
hi = hival * ( maxLo+1 );
log.debug("new hi value: " + hival);
}
As I understand it, for my max_lo of 1000, this code would reserve 1001 ids. Since the lo starts at 1 and resets when it hits 1001, the algorithm only counts through 1000 ids (which is what I would expect).
While this behavior doesn't cause problems when using only hibernate, it makes it quite confusing when trying to use a compatible id generation algorithm outside of hibernate-- for example, in a PL/SQL module-- since the interesting value is 1000 + 1, not 1000).
If I'm misunderstanding what I'm seeing, please let me know. Thanks.