Hello,
I'm mapping a legacy DB in hibernate and I have the following problem:
I have a parent class A and two subclasses B and C. This mapping looks as follows and works fine:
Code:
<class name="A" table="TABLE_A">
<joined-subclass name="B" table="TABLE_B">
</joined-subclass>
<joined-subclass name="C" table="TABLE_C">
</joined-subclass>
</class>
The problem is, that TABLE_B contains a table-per-class-hierachy, that means Class B is also a parent class of two subclasses D and E. The Values D and E are stored in TABLE_B, distinguished by a discriminator-column.
I tried to make a mappingfile like this:
Code:
<class name="A" table="TABLE_A">
<joined-subclass name="B" table="TABLE_B">
<discriminator column="DISCR" type="string" />
<subclass name="D" discriminator-value="D"></subclass>
<subclass name="E" discriminator-value="E"></subclass>
</joined-subclass>
<joined-subclass name="C" table="TABLE_C">
</joined-subclass>
</class>
Whit this mapping I get an validationerror which tells me, that the content of <joined-subclass/> is not well formed.
Can anyone please tell me, how to make this work.
Thank you in advance,
Rudi
Code: