Hibernate Your Data
Subject:   Composite keys in one-to-many or many-to-many
Date:   2004-08-09 06:57:16
From:   jeffcaz
Great tutorial. My questions is, can you and if so how do you set up a relationship that uses a composite primary key. I know it is not the best way to design, but that is not the question.
Can you do something like this?

<set name="orderItems" table="order_items"
cascade="all" inverse="true">
<!-- <key column="order_id"/> -->
<key-property name="orderId"/>
<key-property name="productId"/>
<one-to-many class="test.hibernate.OrderItem"/>

1 to 1 of 1
1 to 1 of 1