-->
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.  [ 2 posts ] 
Author Message
 Post subject: Dealing with composite primary keys
PostPosted: Tue Nov 09, 2010 7:46 am 
Newbie

Joined: Tue Nov 09, 2010 7:31 am
Posts: 4
Hi all !

I'm dealing with a composite primary key, and as long as I know Hibernate do not recommend it, but if I use a surrogate primary key I have to maintain the behavior of the real primary key (not the same values in three fields), so, I need to define a unique index above those fields, or maybe there are some annotations that let me do it ?

Or maybe I can use hibernate with this composite primary key without any problems ?

Any idea is welcome, and thanks in advance !!!


Top
 Profile  
 
 Post subject: Re: Dealing with composite primary keys
PostPosted: Tue Nov 09, 2010 3:17 pm 
Newbie

Joined: Tue Nov 09, 2010 3:08 pm
Posts: 6
Follow this link for Hibernate 3.6 reference manual information on identifiers. Section 5.1.2.1. "Composite identifier" is helpful.

We are currently porting our JDO ORM layer to Hibernate and using Composite identifiers extensively. Hibernate supports Composite identifiers but it can be challenging. In my opinion any real world database must have composite keys.

Hibernate deals really nicely with associative entities.

Good luck!


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