Hi people,
i have two classes, Foo and Bar.
Bar is child of Foo, and both have composite keys.
The problem is that, only sometimes, and i don't understand why, i get the exception :
"Foreign key in table bar must have same number of columns as referenced primary key in table foo".
The mappings are following:
Code:
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.2" default-lazy="false" assembly="Business.Model" namespace="Business.Model" >
<class name="Foo" table="foo" where="type='BAR'">
<composite-id >
<key-property name="Id" column="id" type="System.String"></key-property>
<key-property name="Type" column="type" type="System.String"></key-property>
</composite-id>
<property ... </property>
</class>
</hibernate-mapping>
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.2" default-lazy="false" assembly="Business.Model" namespace="Business.Model" >
<joined-subclass name="Bar" table="bar" extends="Foo">
<key>
<column name="id"/>
<column name="type"/>
</key>
<property ... </property>
</joined-subclass>
</hibernate-mapping>