Hibernate version: 3.0.5
So, I have a three tiered inheritance hierarchy:
I start with base class A which has its own db table. Class B subclasses A, has its own db table, and is mapped using <joined-subclass>. Classes C and D subclass B, but have no additional fields and therefore do not need their own additional db tables. It makes sense that the inheritance relationship between class B and its subclasses C and D should be mapped with a table-per-hierarchy style, which would require a discriminator column in class B.
This is where my problem comes in. Remember that class B is a <joined-subclass> because it extends class A. The mapping DTD does not allow <discriminator> inside of a <joined-subclass>, and my project won't deploy when I put one in. This prevents me from mapping classes C and D in a table-per-hierarchy with class B.
Is forbidding <discriminator> in <joined-subclass> simply an oversight or is there a technical reason for this? Is there a solution to this problem that I am overlooking? Please note that I know I can make separate tables for classes C and D that contain only ids in order to make C and D joined-subclasses as well, but this fills my db with dummy tables and I'd naturally like to avoid that.
Thanks much for you consideration in this issue!
|