nhibernate : mapping to column other than primary key

Posted by frosty on Stack Overflow See other posts from Stack Overflow or by frosty
Published on 2010-05-15T09:52:32Z Indexed on 2010/05/15 9:54 UTC
Read the original article Hit count: 284

I have the following map. My intention is for the order.BasketId to map to orderItem.BasketId. Tho when i look at the sql i see that it's mapping order.Id to orderItem.BasketId. How do i define in my order map which order property to map against basketId. It seems to default to the primary key.

<property name="BasketId" column="Basket_ID" type="Int32"/>
<set name="OrderItems" table="item_basket_contents" generic="true" inverse="true"  >
  <key column="Basket_ID" />
 <one-to-many class="EStore.Domain.Model.OrderItem, EStore.Domain"/>      
</set>

© Stack Overflow or respective owner

Related posts about nhibernate

Related posts about nhibernate-mapping