Please excuse my ignorance on the topic, as I am relatively new to Hibernate / NHibernate, but I have encountered a mapping I can't figure out:
This is what my database table looks like:
<bincontents>
<id>5873715</id>
<title>Video Title</title>
<sortorder>0</sortorder>
<itemid>23079</itemid>
<itemtype>VIDEO</itemtype>
</bincontents>
<bincontents>
<id>5873716</id>
<title>Clip Title</title>
<sortorder>1</sortorder>
<itemid>131854</itemid>
<itemtype>CLIP</itemtype>
</bincontents>
Is there a way to map a one-to-one with a where clause?
So a BinContent object can have ItemType of either VIDEO or CLIP. These are keyed as strings, and I can't change that unfortunately.
So if the ItemType field says "VIDEO", I'd like to have a Many-To-One "Video" object, However if the ItemType field says "CLIP", I'd like to have a Many-To-One Clip.
Help!
I'm not even sure if I want to use a Many-To-One in this case. Perhaps a One-To-One?