Hello,
Looking to my data model, I would like to mix joined-subclass and subclass. Here is a sample of what I would like to do :
Inheritance : Equipment (abstract) <- FamillyEquipment (abstract) <- E001 & E002 & E003 & ...
Data model : EQUIPMENT_TABLE and FAMILLY_EQUIPMENT_TABLE
I would like to use only 2 tables, because the (almost) whole data are stored in the FamillyEquipment, and the real equipment is almost empty. Moreover, I also have :
Inheritance : Equipment (abstract) <- MyEquipmentT001
Data model : EQUIPMENT_TABLE and T001_EQUIPMENT_TABLE
So I would like something like :
Code:
<class name="Equipment" abstract="true">
...
</class>
<joined-subclass name="FamillyEquipment" extends="Equipment" abstract="true">
<key column="equipment_id" />
...
<discriminator column="EQUIPMENT_MODEL" type="string" />
</joined-subclass>
<subclass name="E001" extends="FamillyEquipment" discriminator="E001" />
<subclass name="E002" extends="FamillyEquipment" discriminator="E002" />
<subclass name="E002" extends="FamillyEquipment" discriminator="E003" />
<joined-subclass name="MyEquipmentT001" extends="Equipment">
<key column="equipment_id" />
...
</joined-subclass>
The DTD doesn't allow me to create the discriminator in the joined-subclass, but only in a class definition.
I don't think I want put the discriminator at the very top class, because I'm pretty sure that lot of real equipments will not use the same mecanism, and directly inherit from Equipment.
I'm using Hibernate 4.1.9
What is your point of view on the best way to achieve what I want ?
Thanks
--
Jérémie