-->
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: Negative sequence numbers are generated by hibernate
PostPosted: Thu May 19, 2011 10:22 am 
Newbie

Joined: Thu Jan 12, 2006 4:35 pm
Posts: 13
Hi

I have an object for which i am using the sequence generator.. as follows

Code:
<id name="key" type="long">
         <column name="ASSOCIATE_SEQNUM" sql-type="number" />
         <generator class="org.hibernate.id.enhanced.SequenceStyleGenerator">
            <param name="optimizer">pooled</param>
            <param name="increment_size">10</param>
            <param name="sequence_name">SQ_ASSOCIATE_XREF</param>
         </generator>
      </id>


The increment size is set to be 10. When I send a request to insert 100 instances of this object, the sequence number (key) for these object is in negative numbers. There are 10 records with positive numbers (11 to 20) and the rest have negative numbers.

I have the same setup for sequences for several other objects, that are persisted NOT using spring and hibernate combination, and they get the sequence numbers correctly. Not sure if i am seeing this issue because of the spring and hibernate combination or not.

I am using hibernateTemplate.saveOrUpdate for persisting my objects. Its puzzling and dont know where to look for an answer.

on the other hand, when i check the currval or nextval on the oracle sequence, the number looks right. So hibernate seems to be making the call to oracle to get the next set of sequence numbers.

What am i doing wrong.

TIA.
Srikanth


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.