In my ORM.xml I have
<sequence-generator name="MY_SEQ" allocation-size="-1"
When Hibernate creates the sequence the following statement executes:
create sequence MY_SEQ start with -10 increment by 1
In Derby, negative values can be used in Sequences
I also noticed that if I have:
<sequence-generator name="MY_SEQ" allocation-size="1"
The first time an Id is generated, Hibernate seems to be looping from 0 to initial-value for some reason.
I kept seeing "values next value for" printed to my output. It took about 5 minutes to get the first id generated.
Hibernate 3.6.0, Derby 10.6
Bulk rejecting stale issues. If this is still a legitimate issue on ORM 4, feel free to comment and attach a test case. I'll address responses case-by-case. Thanks!
This is still an issue in 5.2.10.
I'll fix it so a negative allocation size works with negative sequence values for this issue.
will fix NoopOptimizer so it no longer skips negative values and 0 when it has a positive incrementSize.
When explicitly using NoopOptimizer and mapping indicates allocation size < -1; Hibernate will log a warning and use -1 as its allocation size.
This is similar to what Hibernate does when NoopOptimizer is explicitly used with an allocation size > 1; Hibernate logs a warning and uses 1 as its allocation size.
Fixed in master.