At least two options:

1. Have two tables: PersonAddress and BusinessAddress, that contain
PersonId or BusinessId respectively, an index column (the list's
index) and the fields from the Address class (which is still the same
class for both uses). Map this using <list> containing also <key>,
<index> and <composite-element>.

2. You can have a single table for all adresses, then one
PersonToAddress and one BusinessToAddress relation tables. This is
mapped using <list> containing <key>, <index> and <many-to-many>.

This is chapter 6, especially section 6.3 in the reference:
http://nhforge.org/doc/nh/en/index.html.

/Oskar


2009/6/3 Peter <[email protected]>:
>
> I want to use one Address table to store the addresses for Person and
> Business objects.  The Person and Business objects can have multiple
> addresses.
>
> For example:
> public class Person
> { List<Addresses> Addresses {get; set; }
>
> public class Business
> { List<Addresses> Addresses {get; set; }
>
> The problem is I can't figure out how to map this in NHibernate.  I've
> read the book and spent several hours on the forums.  Can someone
> point me in the right direction?
>
> >
>

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

Reply via email to