-->
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: Interesting Mapping Problem
PostPosted: Tue Mar 21, 2006 2:05 pm 
Newbie

Joined: Tue Mar 21, 2006 1:56 am
Posts: 4
Okay here is an interesting situation that I am not sure has a solution:

Assume 2 tables and 1 many/many table as:
Person
personID
firstname

Address
addressID
city
IsPrimaryAddress

Person_address
personID
AddressID

I have a person object and an address object. The default of course would be for Person object to have a List of Addresses property.

However, I really just want person to have a single Address property were the address is "IsPrimaryAddress == true". Now I could solve this on the object by making the list property private and providing a non-mapped property that uses the private property collection. But is there a cleaner mapping way to do this ?


Top
 Profile  
 
 Post subject:
PostPosted: Tue Mar 21, 2006 2:17 pm 
Expert
Expert

Joined: Fri May 13, 2005 11:13 am
Posts: 292
Location: Rochester, NY
I do this in my schema, so my understanding is that the answer is "no". I also limit the collection to the pertinent object using a where="IsPrimary = 1" attribute in the list mapping.

I don't think there is any other mechanism, but I too would love to be proven wrong ;)


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.