-->
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: Problem in 3.2.1.ga with GeneratedValue higher than seq val?
PostPosted: Wed May 09, 2007 7:34 pm 
Newbie

Joined: Fri Jan 12, 2007 4:55 pm
Posts: 3
When we tried upgrading from hibernate-annotations 3.1beta8 to 3.2.1.ga the assignment to an id field for at least one class started behaving very strangely. The mapping did not change and specifies that the id field be generated from a sequence. But my sequence is at around 5,000,000,000 and the records are being created with ids around 250,000,000,000

After rolling back to 3.1 the problem goes away. Is there a problem with my mapping that only surfaces in the newer version? Any suggestions on how to figure out what is going on - I added logging and do see the larger number in the object prior to commit.

@Entity
@Table(name = "shipments")
@SequenceGenerator(name="SHIPMENT_SEQ", sequenceName="shipment_id_sequence")
public class Shipments {

@Id
@Column(name = "shipment_id")
@GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "SHIPMENT_SEQ")
public long getShipmentId() {
return shipmentId;
}


Top
 Profile  
 
 Post subject:
PostPosted: Wed May 09, 2007 9:02 pm 
Newbie

Joined: Sun Apr 22, 2007 10:33 pm
Posts: 11
That appears like a bug to me. You may have to use:

That is the line:
@SequenceGenerator(name="SHIPMENT_SEQ", sequenceName="shipment_id_sequence")
---- will look like---
@SequenceGenerator(name="SHIPMENT_SEQ", sequenceName="shipment_id_sequence", allocationSize = 1, initialValue= 1 )

Note that allocationSize = 1 is more important....

FOR MORE REFER TO:
http://forum.hibernate.org/viewtopic.php?t=973682

_________________
~/Gurram


Top
 Profile  
 
 Post subject:
PostPosted: Thu May 10, 2007 12:43 pm 
Newbie

Joined: Fri Jan 12, 2007 4:55 pm
Posts: 3
Thank you so much, it worked!


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.