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 ...
|