-->
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.  [ 3 posts ] 
Author Message
 Post subject: Why is subclass recommended over joined-subclass?
PostPosted: Tue Oct 31, 2006 3:24 pm 
Senior
Senior

Joined: Sat Mar 25, 2006 9:16 am
Posts: 150
Why do the NH docs say that "subclass" (one table per class hierarchy) is recommended over "joined-subclass" (one table per class)?

I think subclass is ugly because you end up with columns in your database which may or may not be used depending on the value of another column. This prevents you from using constraints to enforce data integrity.

Also, is it possible to use bags, many-to-one, etc., etc. with a joined-subclass? (i.e., only the subclass has these elements). The docs seem to indicate that it is not possible.


Top
 Profile  
 
 Post subject:
PostPosted: Tue Oct 31, 2006 4:46 pm 
Beginner
Beginner

Joined: Fri Oct 20, 2006 8:02 am
Posts: 36
I don't know about your first quastion, but about the seconde you ar wrong.
I do can use bag, many-to-one ... into the joined-subclass.
take a look at the xsd or dtd, it is realy good.


Top
 Profile  
 
 Post subject: Re: Why is subclass recommended over joined-subclass?
PostPosted: Tue Oct 31, 2006 5:47 pm 
Senior
Senior

Joined: Sat May 14, 2005 8:40 am
Posts: 130
grennis wrote:
Why do the NH docs say that "subclass" (one table per class hierarchy) is recommended over "joined-subclass" (one table per class)?


The name already says it: a joined subclass always uses a join when retrieving an object. Now this isn't too bad when you have a single subclass, but especially polymorphic queries with many different subclasses can result into lots of joins that might degrade performance.
As always: this is no golden rule. You have to test it for yourself if this is an issue or not.
Also, I might have forgotten something here, but there are some Java Hibernate docs that explain this stuff.

Quote:
Also, is it possible to use bags, many-to-one, etc., etc. with a joined-subclass? (i.e., only the subclass has these elements). The docs seem to indicate that it is not possible.


It is perfectly possible to do that.

_________________
Cuyahoga


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