-->
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: two key columns for a collection
PostPosted: Fri Jan 18, 2008 3:11 pm 
Newbie

Joined: Tue Dec 04, 2007 4:53 am
Posts: 5
Hi,

the following scenario:

a simple class Person with no special properties and a class PersonRelation with properties PersonA and PersonB and RelationType.

An example would be
Person john = new Person("john");
Person george = new Person("george");
PersonRelation relation = new PersonRelation(john, george, "friends");

this maps in to DB just fine.

But now I want to add a Set to the Person object containing all the PersonRelations it is member of. And the problem I'm now facing is that the Set's key column might be the PersonA or PersonB.

Is there an easy way to tell hibernate to look in both columns (PersonA and PersonB) to find the key?

To me it seems not possible, but I also know that hibernate has some hidden killer-features :-)

thanks in advance


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.