-->
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.  [ 2 posts ] 
Author Message
 Post subject: outer-join with query execution
PostPosted: Thu Jun 10, 2004 4:26 pm 
Newbie

Joined: Thu Jun 10, 2004 3:55 pm
Posts: 2
We are looking into the impact of outer-join on the quantity and quality of the SQL generated by Hibernate. Outer-join configuration worked, as documented, for loading of individual objects and queries built by Hibernate Criteria interface. Outer-join configuration does not make a difference for the top-level object and its direct references, when HQL query is executed, unless one explicitly mentions joins in the HQL query.

For example, For an object Deal with two <many-to-one> associations and a single collection, Hibernate does not create join when retrieving the Deal Object. However, joins are created on all down stream objects. The code is really a single line code.

session.createQuery("from DealImpl as deal where deal.objectId = 501").list();

Is that expected behavior? If not, any ideas what I might be doing wrong?

Thanks and regards

Zafar


Top
 Profile  
 
 Post subject:
PostPosted: Thu Jun 10, 2004 6:45 pm 
Hibernate Team
Hibernate Team

Joined: Mon Aug 25, 2003 9:11 pm
Posts: 4592
Location: Switzerland
A HQL query will not respect or use the default fetching strategies you defined in your mappings. You will have to use the "fetch" HQL keyword of you want eager fetching at runtime. Note that this is by design and a good thing. Also note that a Criteria query does respect the mapping fetching strategies (but you can override them).

_________________
JAVA PERSISTENCE WITH HIBERNATE
http://jpwh.org
Get the book, training, and consulting for your Hibernate team.


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