-->
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.  [ 4 posts ] 
Author Message
 Post subject: Oracle sequence unique ids out of order!
PostPosted: Tue Oct 11, 2005 10:47 pm 
Newbie

Joined: Mon Oct 03, 2005 12:00 am
Posts: 9
hello!

I have setup the below code for an Oracle sequence, when I insert rows,
the unique id seems to be random 41, 63, 69 out of sequence though they have been inserted in a sequence on after the other, why is hibernae doing this? I am able to insert directly using JDBC inserts and the sequence of unique ids gnerated by oracle are maintained

any ideas?

Code:
      <id name="id" type="long" column="id" unsaved-value="0">
         <generator class="sequence">
            <param name="sequence">order_seq</param>
         </generator>
      </id>   


Top
 Profile  
 
 Post subject:
PostPosted: Wed Oct 12, 2005 11:49 pm 
Newbie

Joined: Mon Oct 03, 2005 12:00 am
Posts: 9
Any body has any ideas please?


Top
 Profile  
 
 Post subject:
PostPosted: Thu Oct 13, 2005 12:48 am 
Newbie

Joined: Mon Oct 10, 2005 6:10 am
Posts: 10
As far as I know, Oracle fetches internally a set of sequence number per jdbc-connection (oracle session) and asigns for example id-numbers out of these sets (if all sequence numbers are assinged, another set will be fetched and so on.). So ids might have 'jumps' in their evolution with two or more database-sessions using a 'shared' sequence. I'm not sure, if Oracle assures that seq(t1)>seq(t2).


Top
 Profile  
 
 Post subject:
PostPosted: Fri Oct 14, 2005 3:40 am 
Newbie

Joined: Fri Apr 01, 2005 5:21 am
Posts: 11
Once you get a sequence you cannot get the same one again.
Are you sure you are not getting the sequence from anywhere else?
If you encounter an exception while inserting and then do it all over again, you will get another sequence. So, you may skip sequence nos.

Please check that this isn't happening in ur case.


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