Hello, I have 2 objects that both inherit from a base object that uses a generic ID generator defined like this:
@GenericGenerator(name="peeringobjectgenseq", strategy = "org.hibernate.id.enhanced.SequenceStyleGenerator", parameters = { @Parameter(name = "sequence_name", value = "PEERINGOBJECT_SEQ") , @Parameter(name = "increment_size", value = "10") , @Parameter(name = "optimizer", value = "pooled") } )
In my application, one of the objects is inserted using LOAD FILE so I explicitly reserve IDs as I need by running a SQL and updating the PEERINGOBJECT_SEQ table. The other object is inserted using Hibernate and relies on the SequenceStyleGenerator to generate the IDs.
SequenceStyleGenerator correctly reserves IDs but sometimes uses IDs that it has not reserved.
In the binary SQL log I see the SequenceStyleGenerator running the following query:
update PEERINGOBJECT_SEQ set next_val= 461382 where next_val=461372
but then the INSERT that hibernate runs uses the ID 461362 which is in the middle of the sequences reserved by the LOAD FILE functionality a few minutes earlier. The SequenceStyleGenerator clearly sees that the current available value starts from 461372 based on the UPDATE it runs but for some reason uses a value that is lower.
Any help is appreciated.
Thanks, Brocha
|