-->
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.  [ 3 posts ] 
Author Message
 Post subject: oracle problem with native id generator, HIBERNATE_SEQUENCE
PostPosted: Wed Dec 01, 2004 7:30 pm 
Regular
Regular

Joined: Sun Aug 01, 2004 6:49 pm
Posts: 76
Hibernate version: 2.1.6

I use the native id generator and have seen that for Oracle one sequence is used for all tables. Since I initialize the database with some default data, this leads to errors because the seuqence starts at 1 by default. I solve this by setting the sequence to my highest id in my initial data.

I'm regaled by MySQL's autoincrement on a table basis. So I'm looking for a better solution for Oracle in the same matter? Do you have an advice? (Unfortunately I'm bound to Integer/Long identifiers)

Thanks in advance
Thomas


Top
 Profile  
 
 Post subject:
PostPosted: Wed Dec 01, 2004 7:39 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 7:19 pm
Posts: 2364
Location: Brisbane, Australia
Thats the nature of sequences. They are decoupled.

Its easy to write a PLSQL routine to get the max(id) on the table(s) to reset the appropriate sequence(s).

BTW: You can have individiual sequences per-table for native just set the sequence name in the parameter as you would for the sequence generator.


Top
 Profile  
 
 Post subject:
PostPosted: Wed Dec 01, 2004 7:43 pm 
Regular
Regular

Joined: Sun Aug 01, 2004 6:49 pm
Posts: 76
Hi David,

thanks a lot. This helps me going the right way.

Thomas


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