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: "where" attribute for <one-to-one> mapping
PostPosted: Tue Aug 29, 2006 5:39 pm 
Expert
Expert

Joined: Fri Oct 28, 2005 5:38 pm
Posts: 390
Location: Cedarburg, WI
Hibernate version: 1.0.2

Hibernate 3.x supports a "where" attribute in one-to-one mappings. It looks like NHibernate 1.x does not. Is there any other way to get this functionality? E.g. I have a Contact entity with a Phones property. In addition that, I would like a "shortcut" property PrimaryPhone, which exposes the phone (if any) where IsPrimary = true.

Having these redundant "shortcut" one-to-one properties would simplify most of our queries, since nearly all of our child collections have one or more indicators like IsPrimary or some kind of simple code, and it would be very nice to be able to get at those directly on the parent entity without explicitly digging it out of the collection. It would also solve the problem with outer joins lacking an ON clause.

Does anyone know of a workaround for this, short of creating a new class just for the condition? I don't want to create a new class, since for example a given contact's phone may change from being primary to non-primary. If PrimaryPhone were its own class as distinct from just Phone, that would seem to be a problem ...

I also didn't see anything in JIRA about this ...


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.