-->
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.  [ 3 posts ] 
Author Message
 Post subject: Hibernate Generating sequences in multiples of 50
PostPosted: Tue Jan 16, 2007 10:12 pm 
Regular
Regular

Joined: Thu Jul 29, 2004 11:55 pm
Posts: 75
I am using Hibernate 3.2.1GA (annotations and entity manager). When hibernate is generating my ids, it is multiplying the returned sequence value by 50. How do I get it to use the returned sequence value?

Using
@SequenceGenerator(name="MySequence", sequenceName="MY_SEQ")

@Id
@GeneratedValue(strategy=GenerationType.SEQUENCE, generator="MySequence")
public long getId() { return id;}


Top
 Profile  
 
 Post subject:
PostPosted: Tue Jan 16, 2007 10:17 pm 
Regular
Regular

Joined: Thu Jul 29, 2004 11:55 pm
Posts: 75
If I set the allocation size to 1, I get the correct value.


Top
 Profile  
 
 Post subject:
PostPosted: Tue Jan 16, 2007 10:21 pm 
Regular
Regular

Joined: Thu Jul 29, 2004 11:55 pm
Posts: 75
Isn't the allocation size supposed to be the number of sequences it gets each time it accesses the table to reduce the number of times it has to hit the sequence? If so, then I think there are two bugs occurring here:

1) the sequence value is not being adjusted to the "hi" value. If the DB returns 1 and hibernate thinks it got back 50 values, shouldn't the next sequence value be 51

2) hibernate is just multiplying the returned value by the allocation size and not actually using the returned values. (ie. seq = 1, hibernate sets id to 50, next access seq=2, hibernate sets id to 100


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

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.