Unfortunately every table uses identity generators which is stopping me from making that Person.Pet connection.
It also turns out that a single person usually has both a Cat and a Dog associated with it even though only one of them is really valid. I think I may have to end up with a collection per type and some manual code to clean things up. I hate legacy databases. Thanks for your help, Barry On Jan 20, 11:25 am, Oskar Berggren <[email protected]> wrote: > Let the setter for Person.Pet check the type and set People.TypeOfPet > (which would not be a special field as far as nhibernate is > concerned). Use table-per-concrete-class (<union-subclass>) for the > pet classes. > > /Oskar > > 2010/1/19 Barry Dahlberg <[email protected]>: > > > Hi, > > > I have a fixed legacy database with a table structure like to this: > > > People > > TypeOfPet > > > Cat > > OwnerId > > > Dog > > OwnerId > > > I would like to map this classes like this: > > > Person > > Pet > > > Pet > > Owner > > > Cat : Pet > > > Dog : Pet > > > Notice that the ideal discriminator, TypeOfPet, is in the People table > > which is mapped to Person. I want to be able to assign a new pet to a > > person which should update TypeOfPet. > > > Does NHibernate have a way of mapping this directly? > > > Cheers > > Barry > > > -- > > You received this message because you are subscribed to the Google Groups > > "nhusers" group. > > To post to this group, send email to [email protected]. > > To unsubscribe from this group, send email to > > [email protected]. > > For more options, visit this group > > athttp://groups.google.com/group/nhusers?hl=en. > >
-- You received this message because you are subscribed to the Google Groups "nhusers" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/nhusers?hl=en.
