Hi Nilson,
a classic one to many relation is order and orderitems.
So one order with many order Items.
The OrderItem has a foreign key to the orders primary key.
In your Order mapping file you would declare your relation like this
<bag name="OrderItems" table="PSVI_ORDERITEMS" inverse="true"
lazy="true" >
<key>
<column name="CLIENT_ID"/>
<column name="ORDER_ID"/>
</key>
<one-to-many class="OrderItemEntity"/>
</bag>
And in your OrderItem you would referenc back to the order.
<many-to-one name="Order" class="OrderEntity" insert="false"
update="false" lazy="proxy">
<column name="CLIENT_ID"/>
<column name="ORDER_ID"/>
</many-to-one>
hope this helps
On 26 Mai, 17:09, Nilson <[email protected]> wrote:
> Hello!
>
> I'm a newbie in this matter, and i'm starting to use nhibernate.
> I couldn't find any posts refering this.
>
> So i'm having some doubts...
> When you have a relation between two tables and one of the tables has
> two primary keys and the other only has one, does this mean we have a
> one to many relation?
>
> Thanks,
> Nelson Santos
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---