-->
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.  [ 2 posts ] 
Author Message
 Post subject: problem with @TableGenerator when allocationSize > 1
PostPosted: Fri Apr 23, 2010 2:08 pm 
Newbie

Joined: Thu Apr 22, 2010 12:13 pm
Posts: 3
Hi,

I'm using hibernate 3.5.0-CR2 with MySQL server 5.1.44 (through mysql-connector-java-5.1.9) on Windows.
I'm using JPA 2.0 and using the @TableGenerator to generate ids as below:

@Id
@GeneratedValue(strategy=GenerationType.TABLE, generator="EnterpriseSequence")
@TableGenerator(name="EnterpriseSequence", table="sequencetable", pkColumnName="sequenceName",
valueColumnName="sequenceCount", pkColumnValue="EnterpriseSequence", allocationSize=1)
private long id;

When allocationSize=1 then everything works fine. The ids are generated and the sequence count in the database is updated. But when allocationSize > 1, even after the allocationSize number of ids are used up hibernate doesn't seem to go get the next sequence count to base the id generation on (i.e. the sequence count in not updated in database). When app is started up again, it reads the sequence count which is now incorrect and generates ids which have been already used. According to the log output, MultipleHiLoPerTableGenerator is being used.

Len


Top
 Profile  
 
 Post subject: Re: problem with @TableGenerator when allocationSize > 1
PostPosted: Thu May 27, 2010 4:42 pm 
Newbie

Joined: Thu May 27, 2010 4:40 pm
Posts: 1
I am having this exact problem - any suggestions out there? In my case, I'm using an MS SQL database.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 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.