-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
 Post subject: SequenceStyleGenerator using invalid IDs
PostPosted: Tue Jul 21, 2009 6:05 am 
Newbie

Joined: Tue Nov 04, 2008 8:37 am
Posts: 1
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


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.