-->
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.  [ 1 post ] 
Author Message
 Post subject: filter lazy initialised collection
PostPosted: Fri Jul 27, 2012 10:17 am 
Newbie

Joined: Thu Jul 26, 2012 5:19 am
Posts: 2
I am having some performance issues due to some HQL queries resulting in large Cartesian Products. To get around this I'm trying to lazy fetch the collections although I cant find a nice way of applying a where clause to resulting collections.

Simplified version of the original HQL query

Code:
SELECT TPR
FROM TacticalPriceRule
INNER JOIN FETCH TPR.tacticalPriceRuleDurations TPRD
LEFT JOIN FETCH TPR.tacticalPriceRuleCountryOfOrigins as TPRCOO 
LEFT JOIN FETCH TPR.tacticalPriceRuleType as TPRT 
LEFT JOIN FETCH TPR.tacticalPriceRuleCars as TPRC 
WHERE
     TPRD.duration.min <= :duration and TPRD.duration.max >= :duration
     .... more conditions on other joins

This results in nearly nearly 1 million rows for a few tiny tables. Not ideal.

If I attempt to do this using lazy initialisation, any 'where' or 'with' clauses are ignored and the entire sets matching the tactical price rule is contained within the collection.

Same applies for subselect fetch types.

Thanks,

Dan


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

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.