I migrated from Hibernate 5 to 6, in the old implementation I used SequenceGenerator @SequenceGenerator(name = "SEQ_NAME", sequenceName = "SEQ_NAME", allocationSize = 50)
, this called SequenceHiLoGenerator and LegacyHiLoAlgorithmOptimizer.
The behavior was: if the last value of sequence in database is 100, the value is multiplied by allocationSize (100x50=5000), the value of sequence stared in 5000, 5001…5049.
The hibernate 6 version multiple by allocationSize/incrementSize +1.
Below code segment is the implementation of sequence in hibernate 6
@GenericGenerator(
name = "X_SEQ",
type = org.hibernate.id.enhanced.SequenceStyleGenerator.class,
parameters = {
@Parameter(name = "sequence_name", value = "X_SEQ"),
@Parameter(name = "initial_value", value = "1"),
@Parameter(name = "increment_size", value = "50"),
@Parameter(name = "optimizer", value = "legacy-hilo")
})
Same example, last value of sequence in database is 100, the value is multiplied by increment_size+1 (100x51=5100), the value of sequence stared in 5100, 5101…5149.
In hibernate 5 the maxLo value is 49 (allocationSize-1), in hibernate 6 the maxLo is the same incrementSize (50)
Is this a bug?
Did I miss something in the configuration?
Thanks in advance.