I have these mappings:
Code:
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.2"
assembly="MyProject.Dto" namespace="MyProject.Dto.AbstractEntities">
<class name="AbstractItem" table="ABSTRACT_ITEM">
<id name="Id" column="ID" type="Int32" unsaved-value="0">
<generator class="identity" />
</id>
...
<joined-subclass name="MyProject.Dto.ConcreteItem, MyProject.Dto" table="CONCRETE_ITEM">
<key column="ABSTRACT_ITEM_ID" />
...
</joined-subclass>
</class>
</hibernate-mapping>
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.2"
assembly="MyProject.Dto" namespace="MyProject.Dto">
<class name="User" table="USER">
<id name="Id" column="ID" type="String">
<generator class="assigned" />
</id>
...
</class>
</hibernate-mapping>
My User entity needs a bag of ConcreteItems, but the relationship is a column in the ABSTRACT_ITEM table. I'm trying with this:
Code:
<bag name="ConcreteItems" inverse="true" cascade="all-delete-orphan">
<key column="USER_ID"/>
<one-to-many class="ConcreteItem" />
</bag>
But I get an exception because the USER_ID column cannot be found in the CONCRETE_ITEM table. Any ideas please? Thanks!