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!!!!
|