-->
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: Performance in queries
PostPosted: Sun Oct 12, 2008 10:48 am 
Newbie

Joined: Sun Oct 12, 2008 10:42 am
Posts: 1
Hi,

We are using hibernate 3.1, For searching a data in the table we need to refer atleast three tables.

Which one of the following option is best
1. Using Criteria
2. Using Outer join HQL queries
3. Using Inner Join in HQL queries

Whether HQL queries minimize the performance of Hibernate or not ?


Thanks in advance.


Top
 Profile  
 
 Post subject:
PostPosted: Sun Oct 12, 2008 6:46 pm 
Expert
Expert

Joined: Mon Nov 26, 2007 2:29 pm
Posts: 443
HQL is a little more flexible than Criteria, but, ultimately, the options you give are irrelevant in relation to performance.

Your HQL using inner or outer joins should depend on the business needs of your application, rather than on performance considerations.
For example, when you need a parent present in a resultset even when there are no children, you use an outer join.

A much better way to tune the performance of your queries is to focus on their fetching strategy, both in terms of what kind of fetching you do (join, subselect) and when you do it (eager, lazy).

_________________
Gonzalo Díaz


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.