sorry yesterday I just posted some code excerpt conceptualized from one-level inheritance.
The problem you encountered is caused by
<discriminator column="type" type="string"/>
cannot be put under <subclass> and <joint-subclass> is not able to be nested. I try to run a similar code today to achieve the functions you may need. I tried to put <join> under <subclass> to simulate a <joint-subclass>, but <discriminator> will not work in this way.
So the only thing I can come up with is to make a one-to-one association between Animal and Mammal. Here is the code that I tried, it may look awkward for the concept.
<hibernate-mapping>
<class name="bean.Animal" table="animal">
<id name="id" type="java.lang.Integer">
<column name="id" length="50" scale="0" />
</id>
<many-to-one name="mammal"
column="mammal_id"
not-null="true"/>
</class>
<class name="bean.Mammal" table="mammal">
<id name="mammal_id" type="java.lang.Integer">
<column name="mammal_id" length="50" scale="0" />
</id>
<discriminator column="type" type="string"/>
<subclass name="bean.Dog" extends="bean.Mammal" discriminator-value="dog">
</subclass>
<subclass name="bean.Cat" extends="bean.Mammal" discriminator-value="cat">
</subclass>
</class>
And the result table is:
+------------------------------+
|Tables |
+------------------------------+
|animal |
|mammal |
+------------------------------+
And the schemas in those tables are
+------------------------------+
|animal |
+------------------------------+
|id |
|mammal_id |
+------------------------------+
+------------------------------+
|mammal |
+------------------------------+
|mammal_id |
|type |
+------------------------------+
Hope this will help. BTW, I am still wondering what is the reason that you don't use annotation to solve this problem since you have the solution, just curious:).