-->
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: Hoist join when paging?
PostPosted: Thu Aug 25, 2005 6:44 am 
Newbie

Joined: Tue Nov 02, 2004 9:15 am
Posts: 5
Hibernate version: 2.1.7

Name and version of the database you are using: Oracle 9.2.0.6, JDBC Driver 10.1.0.2.0

We have a table ORDERS that contains > 300K records. We do a query on this table of the form:
FROM orders WHERE customer = ? ORDER BY dateCreated DESC

The result of the this query is approx. 2000 records. We then use the standard hibernate paging pattern (setMaxResults/setFirstResult) to page through the query result. This works very well.

However, we now need to include extra information in the result that comes from a view. This view internally calls stored procedures. So the query form now looks like:
FROM orders, orderStatus WHERE orderStatus.orderNumber = orders.orderNumber AND orders.customer = ? ORDER BY dateCreated DESC

The problem is that the time it takes to execute the query is now much, much worse (10 seconds compared to 200ms).

Is there anyway to get hibernate to only perform the join after having first done the paging?

I know from my data that the join cannot affect the results of the query, only add information about the results.

Any help would be greatly appreciated,
David Sykes


Top
 Profile  
 
 Post subject: sql
PostPosted: Fri Aug 26, 2005 11:59 am 
Expert
Expert

Joined: Fri Jul 22, 2005 2:42 pm
Posts: 670
Location: Seattle, WA
H might not perform join in the case but try to execute one extra SQL for every row to get the extra enformation you need.

Please set show_sql=true in the configuration file and send a log.

_________________
--------------
Konstantin

SourceLabs - dependable OpenSource systems


Top
 Profile  
 
 Post subject:
PostPosted: Fri Aug 26, 2005 2:09 pm 
Expert
Expert

Joined: Sat Jun 12, 2004 4:49 pm
Posts: 915
try with ScrollableResultset


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.