We have a 3rd party database (Oracle) that we cannot change as the application sitting on top is still very much in use. We are extending it though and have, thus far, been successful at using NHibernate with it.
I have run into a road block with one part. We have a table that represents an idea of Attributes. These attributes have a relationship to either Household, Person or Card (think of that as a Hierarchy in that People have cards and those people make up a household). The problem lies in that the AttributeValue table joins to either Household, Person or Card Id based on a CPHLevel column with either C (card), P (Person ), or H (Household ), but I wouldn't say that there should be three subclasses or joined classes for each permuation
So a select for the card's attribute values would look something like this (manually created):
Code:
select attdef.name, attval.value
from attributedetail attval
inner join attributedefinition attdef on attval.attributeid = attdef.attributeid
inner join card on attval.customerkey = card.id
where def.cphlevel = 'C' and card.cardnumber = 'ABC123456'
While a households attribute select would look like this:
Code:
select attdef.name, attval.value
from attributedetail attval
inner join attributedefinition attdef on attval.attributeid = attdef.attributeid
inner join household on attval.customerkey = household.id
where def.cphlevel = 'H' and household.State = 'OH'
What would you recommend the Model and/or hbm files look like? I'm kinda stumped.