-->
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.  [ 5 posts ] 
Author Message
 Post subject: Is there a way to turn off polymorphism?
PostPosted: Tue Aug 31, 2004 11:29 am 
Newbie

Joined: Tue Aug 31, 2004 10:53 am
Posts: 4
Hello All,
I have a database with a good number of joined subclasses, which works great for the business logic where the polymorphic behavior is truly desired. However, there is also a number if cases where we are only interested in the information from the base class but we still have to incur the overhead of all the outer joins in the queries.
So I was wondering if there is a way to turn off the generation of the outer joins for subclasses in Hibernate and load only a base class in a query.
I'm using Hibernate 2.1.6; all subclasses have lazy=true.

Thank you,
Alexander


Top
 Profile  
 
 Post subject:
PostPosted: Tue Aug 31, 2004 4:45 pm 
Proxool Developer
Proxool Developer

Joined: Tue Aug 26, 2003 10:42 am
Posts: 373
Location: Belgium
Why don't you simply query for the base class then ?

Somehting like:
Code:
from BaseClass c where ...


Top
 Profile  
 
 Post subject:
PostPosted: Tue Aug 31, 2004 5:39 pm 
Newbie

Joined: Tue Aug 31, 2004 10:53 am
Posts: 4
Aren't all Hibernate queries polymorphic by default, so
Code:
from BaseClass c where ...

will result in a SQL with n outer joins where n is the number of joined subclasses (subclasses are defined in the BaseClass mapping)?

Thanks,
Alexander


Top
 Profile  
 
 Post subject:
PostPosted: Tue Aug 31, 2004 5:51 pm 
Proxool Developer
Proxool Developer

Joined: Tue Aug 26, 2003 10:42 am
Posts: 373
Location: Belgium
Not sure about it... but is the "polymorphism" attribute useful in your case (see


Top
 Profile  
 
 Post subject:
PostPosted: Tue Aug 31, 2004 7:22 pm 
Newbie

Joined: Tue Aug 31, 2004 10:53 am
Posts: 4
I do use "explicit" polymorphism everywhere, "implicit" is more broad. According to the same section of the documentation, "explicit" still loads all the subclasses, so I was looking for a magic setting that would allow me to alter this behavior.

Thanks,
Alexander


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