views:

207

answers:

0

I have a class in Nhibernate hbm file and for this I'm using a composite id field, in the following way :

 <composite-id>
    <key-many-to-one name="DContent" class="Business.Entities.DContent, Business" column="DId" />
    <key-many-to-one name="Structure" class="Business.Entities.Structure, Business" column="RId"/>
    <key-property name="Language"></key-property>
 </composite-id>

</class>

where DContent & Structure are classes and Language is an int.

I've overwritten the Equals & GetHashCode methods, to keep trace of the 3 objects in the composite key, but what I've discovered is that when it's creating the table in the database only the two DId & RId are part of the primary key, and not the Language.

My question is : Why NHibernate doesn't see that the Language is part of the primary key??

Thank you, Catalin