-->
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.  [ 8 posts ] 
Author Message
 Post subject: Deep inheritance hierarchy
PostPosted: Thu Jun 23, 2005 4:18 pm 
Newbie

Joined: Mon Jun 20, 2005 2:02 pm
Posts: 8
Location: San Jose, CA
Folk,

I have a deep inheritance hierarchy I am trying to map to Hibernate. There are about 180 classes in the set. All classes are commonly rooted in a single class, Top. Top has numerous associations bound to it so that all objects have the option of participating in those associations.

The problem I face is how to resolve the abstract class Top without requiring all classes to reside in a single table.

Any suggestions welcome.

Thanks

-steve

_________________
Stephen Schleimer
(408) 527-3291
Cisco Systems, Inc


Top
 Profile  
 
 Post subject:
PostPosted: Thu Jun 23, 2005 6:32 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 12:50 pm
Posts: 5130
Location: Melbourne, Australia
union subclass mapping?


or, simply don't map the superclass and map its properties in the subclasses


Top
 Profile  
 
 Post subject:
PostPosted: Thu Jun 23, 2005 6:46 pm 
Newbie

Joined: Mon Jun 20, 2005 2:02 pm
Posts: 8
Location: San Jose, CA
"simply don't map the superclass and map its properties in the subclasses"

Thanks for the response. I essentially do not map the superclass at this time. However, it is not clear how to map the associations which bind to the superclass. The alternative of binding to each subclass table (I map trees to tables rather than individuals) is daunting and will result in a combinatorically large set of associations.

So, I want to make use of Top (the supper class) for associations but am getting failures of the Hibernate mappings (even though I have a interface declaring Top).

The other alternative (union subclass mapping) I understand requires that all the subclasses are mapped to individual tables. This will tend to create a lot of tables whith a lot of unioned selects. However, I will try this out to see if it works.

_________________
Stephen Schleimer
(408) 527-3291
Cisco Systems, Inc


Top
 Profile  
 
 Post subject:
PostPosted: Thu Jun 23, 2005 6:53 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 12:50 pm
Posts: 5130
Location: Melbourne, Australia
Well, if you actually *want* a table for the top classes, use an ordinary old join-subclass mapping....


Top
 Profile  
 
 Post subject:
PostPosted: Thu Jun 23, 2005 7:37 pm 
Newbie

Joined: Mon Jun 20, 2005 2:02 pm
Posts: 8
Location: San Jose, CA
I should preface this by saying that the very rich model I am working with is the CIM model fo the DMTF as specalized for Cisco Network Management devision. The model is very extensive and has many associations at the highest level (there are 13 which include Top 3 of which are reflexive). The only source in the development path is the model definition in UML. Everything else is automatically generated including both the POJOs and the Hibernate mapping files.

I explicitly do not want tables for the top classes (there are several layers before we hit concrete classes to permit the very rich association model). What I want it to create tables for fragments of the hierarchy cutting where it makes sense (because of performance or other issues). I would like to minimize the number of tables (so I have a mechanism which permits the cut class to be abstract and include all other classes below that abstract class in the table as well. Sometime is is necessary to cut a concrete class out of a hierarchy (again for performance or other reasons). When this is done, I essentially create a new hierarchy table starting at the cutPoint class (the concrete class of interest).

So, given the relatively complex mapping just described, I am struggling to understand how to generate mappings which will support all of this. My (flawed) understanding of join-subclass requires that I have a discrete table per subclass (as opposed to the hierarchies I am mapping). That does not fit in with the partioning model I have described.

I imagine that it is possible to treat a table-per-hierarchy table as a table-per-subclass kind of thing with appropriate mapping. Further, I hope that there is a way to gather the many table-per-hierarchy tables together to permit the associations bound to the top classes to range over them (perhaps ultimately generating unioned joins or ...)

I appreciate any guidance you all can provide.

-steve

_________________
Stephen Schleimer
(408) 527-3291
Cisco Systems, Inc


Top
 Profile  
 
 Post subject:
PostPosted: Thu Jun 23, 2005 7:41 pm 
Hibernate Team
Hibernate Team

Joined: Mon Aug 25, 2003 9:11 pm
Posts: 4592
Location: Switzerland
DMTF is evil, I wasted a whole week on that two years ago :)


Top
 Profile  
 
 Post subject:
PostPosted: Thu Jun 23, 2005 9:59 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 12:50 pm
Posts: 5130
Location: Melbourne, Australia
Yes, thats why I originally recommended union-subclass. I mean, there are only two logical possibilities: either there is a table for Top (in which case, you can join to it to get polymorphism), or there is not (in which case, you must union).

It is simply not a logical possibility to have polymorphism, no table, and no union.


Top
 Profile  
 
 Post subject:
PostPosted: Fri Jun 24, 2005 4:23 pm 
Newbie

Joined: Mon Jun 20, 2005 2:02 pm
Posts: 8
Location: San Jose, CA
[quote="gavin"]Yes, thats why I originally recommended union-subclass. I mean, there are only two logical possibilities: either there is a table for Top (in which case, you can join to it to get polymorphism), or there is not (in which case, you must union).

It is simply not a logical possibility to have polymorphism, no table, and no union.[/quote]

Ok. How do I create a union of tables of class hierarchy?

_________________
Stephen Schleimer
(408) 527-3291
Cisco Systems, Inc


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 8 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.