-->
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.  [ 4 posts ] 
Author Message
 Post subject: Multiple Inheritance strategies in heirarchy
PostPosted: Tue Mar 15, 2005 10:50 am 
Newbie

Joined: Tue Mar 15, 2005 10:36 am
Posts: 4
Is it possible to have multiple inheritance strategies in an inheritance heirarchy? This is primarly for use with EJB3 POJOs. It does seem valuable to be able to have something like:

Code:
BusinessObject

BasePart extends BusinessObject (joined with BusinessObject)
BaseRequirement extends BusinessObject (joined with BusinessObject)

MechanicalPart extends BasePart (separate table)
Motor extends MechanicalPart (sametable with MechanicalPart)


etc..

The reason for this is that the system I am designing will have a *lot* of polymorphism, and having it all in one table will be too much to manage. Each type may have a lot of new attributes as well and the sum will probably exceed the max number of columns if it is all in one table

Is this possible with hibernate (or should it be possible in a future version?)

or should I just take the perf hit for the joins? How bad is it really? I don't expect the inheritance heirarchy to go much deeper than ~10 levels but that is already quite deep if you have to join over 10 tables...

From what I can see it makes the sql visually more complicated, but it might speed things up significantly if I can choose where in the heirarchy to do the joins..

Thanks for any insight
Feint


Top
 Profile  
 
 Post subject:
PostPosted: Tue Mar 15, 2005 11:23 am 
Pro
Pro

Joined: Tue Aug 26, 2003 1:24 pm
Posts: 213
Location: Richardson, TX
Quote:
Is it possible to have multiple inheritance strategies in an inheritance heirarchy?

Yes. Read the manual: http://www.hibernate.org/hib_docs/v3/re ... tance.html


Top
 Profile  
 
 Post subject:
PostPosted: Tue Mar 15, 2005 5:38 pm 
Newbie

Joined: Tue Mar 15, 2005 10:36 am
Posts: 4
Ok, I see how 9.1.4 somewhat addresses the question as well as some of 9.1.7..

Unfortunately I just finished digging into the EJB3 persistence spec draft 2 page 104:
Quote:
The strategy and the discriminatorType are only specified once per class hierarchy (in the root class), while the discriminatorValue should be specified for each class in the hierarchy.


Which means that even though Hibernate seems to support what I want to do, EJB does not..

ARGH..


Top
 Profile  
 
 Post subject:
PostPosted: Tue Mar 15, 2005 5:55 pm 
Pro
Pro

Joined: Tue Aug 26, 2003 1:24 pm
Posts: 213
Location: Richardson, TX
Then just switch whole hog to hibernate. :)


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

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.