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: please help very urgent - regarding @SequenceGenerator
PostPosted: Wed Apr 07, 2010 11:11 am 
Newbie

Joined: Thu Apr 01, 2010 6:09 pm
Posts: 8
Hi

I have been banging my head for the past entire day and I decided to open it up here since i dint get any result.

We are using
@Id
@GeneratedValue(strategy=GenerationType.SEQUENCE, generator="sample.roster_id_seq")
@SequenceGenerator(name="sample.roster_id_seq", sequenceName="sample.roster_id_seq")

for the id mappings in our table. where sample is the schema name.

However, in some of our tables, we see that the id that is generated by hibernate is not the same as the dbseq val.

Ex: table 1 when i insert an object - id column is equal to the lastval of the dbseq
table 2 - when i insert an object - id column is equal to the lastval of the dbseq * 50 (I understand that the default allocation size in @sequencegenerator is 50)

on opening up the debug level log in hibernate i see the following
table 1
2010-04-07 09:49:43,599 DEBUG [http-80-2] - select nextval ('sample.roster_id_seq')
2010-04-07 09:49:43,630 DEBUG [http-80-2] - Sequence identifier generated: 32
2010-04-07 09:49:43,630 DEBUG [http-80-2] - insert into sample.roster....

But why should be the difference in table 1 and 2 when both use the same annotations in the model and the schema for both in the db is also very similar.

table 2

2010-04-07 09:56:43,599 DEBUG [http-80-2] - select nextval ('sample.schools_id_seq')
2010-04-07 09:56:43,630 DEBUG [http-80-2] - Sequence identifier generated: 81
2010-04-07 09:56:43,630 DEBUG [http-80-2] - new hi value: 81
2010-04-07 09:56:43,630 DEBUG [http-80-2] - insert into sample.schools...


PLEASE PLEASE HELP ME. AM BREAKING WITH THIS for the past 1 full day!!!!


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.