-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
 Post subject: How to mix joined-sublass and subclass
PostPosted: Tue Feb 26, 2013 5:34 am 
Newbie

Joined: Tue Feb 26, 2013 5:03 am
Posts: 1
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


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.