Ah, that should look like this:
Code:
<composite-id name="compID" class="OrderDetailCompId">
<key-many-to-one name="order" class="Order" column="orderid" />
<key-property name="userid" column="userid"/>
</composite-id>
and you OrderDetailCompId should look like this:
Code:
public class OrderDetailCompId {
public Order getOrder() {...}
public void setOrder(Order o) {...}
public String getUserid() {...}
public void setUserid() {...}
}
Relationships are allways made with Object references, never with storing the key of the related object in a property.