-->
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: Requesting design feedback on generated ID's and multiple db
PostPosted: Tue Aug 19, 2008 3:55 pm 
Newbie

Joined: Tue Dec 12, 2006 3:39 pm
Posts: 2
We are in the midst of restructuring our backend to utilize Hibernate and replace our current POJO structure (currently this is just a straight up call to various stored procedures). We have multiple RDBMS's to support and my main concern at the moment is determining the best method for handling generated ID's. Our main two platforms are SQL Server and DB2 (I know - odd), which both support IDENTITY, but shortly we'll be incoprorating Oracle which supports SEQUENCE only (oddly enough, DB2 supports both IDENTITY and SEQUENCE).

So, do we go native (which will require a certain amount of rewriting on our part, but that's inevitibale)? Create separate hbm.xml mappings per platform that target sequence or identity as appropriate (about 250 objects)? Is there another option I'm missing?

I'd love to hear from anyone who has implemented or has come to the same crossroads in decision making.

Thanks!


Top
 Profile  
 
 Post subject:
PostPosted: Wed Aug 20, 2008 3:43 am 
Expert
Expert

Joined: Wed Mar 03, 2004 6:35 am
Posts: 1240
Location: Lund, Sweden
We are supporting PostgreSQL and MySQL in our application. PostgreSQL only has SEQUENCE generators and MySQL only has IDENTITY generator.
We are using the NATIVE generator in Hibernate and this works very well.

Code:
<id name="id" column="`id`" type="int">
    <generator class="native" />
</id>


Top
 Profile  
 
 Post subject:
PostPosted: Wed Aug 20, 2008 4:31 am 
Hibernate Team
Hibernate Team

Joined: Mon Aug 25, 2003 9:11 pm
Posts: 4592
Location: Switzerland
http://in.relation.to/Bloggers/New323HibernateIdentifierGenerators

_________________
JAVA PERSISTENCE WITH HIBERNATE
http://jpwh.org
Get the book, training, and consulting for your Hibernate team.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Aug 21, 2008 12:47 pm 
Newbie

Joined: Tue Dec 12, 2006 3:39 pm
Posts: 2
Thanks much for the replies - the new generators are definitely worth looking into.

Thanks much and wish me luck!


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.