One way might be to map the common properties in Person to a Person table, and table-per-subclass for the other two. ContactAdress would now have a foreign key pointing to the Person table.
This also works with the table-per-hierarchy model, if you don't feel strongly about having BusinessUser and BusinessContact in different tables. Another alternative is to introduce two additional join tables so you'd Bu<-BuCaLink->Ca and Bc<-BcCaLink->Ca. /Oskar 2009/11/17 Filip <[email protected]>: > Hello, > > I'm not entirely sure how to map the following objects, could someone > point me in the right direction please. > > I have BusinessUser and BusinessContact that both inherit from > Person. > Person has firstName, lastName and ISet<ContactAddress>. > BusinessUser and BusinessContact have additional properties related to > their type. In the business layer a "Business" has many > "BusinessUsers", each "BusinessUser" has many "BusinessContact"s. > BusinessUser is saved in BusinessUsers table and BusinessContact is > saved in BusinessContacts table. > > If I had separate tables for BusinessUser_ContactAddress and > BusinessContact_ContactAddress it would be simple one-to-many mapping, > but I would like to have just one table for ContactAddress. Is this > possible to map using hbm files and if so, how? > > Thanks in advance, > Filip > > -- > > 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=. > > > -- 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=.
