Hi,
I have multilevel inheritance: C extends B; B extends A, and wish to implement this using table-per-subclass.
I am working with Fluent NHibernate for my configuration and mappings but I have been unable to program the mapping for this example. The NHibernate mapping looks as follows and works properly:
Code:
<?xml version="1.0" encoding="utf-8" ?>
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.2" auto-import="true" assembly="RecipeGenerator" namespace="RecipeGenerator.Models.Objects">
<class name="A" lazy="true">
<id name="ID" />
<property name="Name" />
<joined-subclass name="B">
<key column="ID"/>
<property name="SomeProperty" />
<joined-subclass name="C">
<key column="ID"/>
<property name="SomeOtherProperty" />
</joined-subclass>
</joined-subclass>
</class>
</hibernate-mapping>
My idea was to use Subclass for B and C as follows (omitting their methods for the sake of explainability):
Code:
public class Amap : ClassMap<A>
{}
public class Bmap : SubclassMap<B>
{}
public class Cmap : SubclassMap<C>
{}
But when retrieving C objects from the database it gives the following error message:
"Duplicate class/entity mapping".
Any idea how I could remedy this?