The <join> clause is for when you want to "merge" two or more tables
into the same class. In your case, it seems natural to have a Person
class that references an Address class. These are mapped to separate
tables, and the relation is mapped using <one-to-one> or <many-to-one>
(even if in practice it is one-to-one). This appear to be a quite
common usecase, unless you absolutely insist that you cannot have a
separate Address class.

/Oskar


2009/6/29 ike bailey <vanilla...@gmail.com>:
> The example I gave is one that I found
> here: http://ayende.com/Blog/archive/2007/04/24/Multi-Table-Entities-in-NHibernate.aspx
> It's a good example, but the tables that we have in our database are more
> complex than this example and to get all the info for a single person we
> must join 5 or 6 tables. In the example the person_id is the primary key for
> the person table and the address_id is a foreign key that relates back to
> the person_id. What I would like to do is specify which table and column to
> join on. Let's say that the person table had an address_id to relate to the
> address table. So instead of the address.address_id relating to the
> person.person_id, address.address_id would relate to person.address_id. I'm
> not sure nhibernate can handle this situation.
>
> On Fri, Jun 26, 2009 at 3:13 PM, Fabio Maulo <fabioma...@gmail.com> wrote:
>>
>> 2009/6/26 ike bailey <vanilla...@gmail.com>
>>>
>>> This example shows how to map multiple tables, but it assumes that the
>>> address_id maps to the person_id. I would like to map the address_id of the
>>> address table to the address_id of the person table
>>
>> Which is the name of the pattern ?
>> I don't know it.
>> Probably you are looking for a one-to-one relation.
>> --
>> Fabio Maulo
>>
>>
>
>
>
> --
> Isaac Bailey
>
> >
>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"nhusers" group.
To post to this group, send email to nhusers@googlegroups.com
To unsubscribe from this group, send email to 
nhusers+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/nhusers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to