-->
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: limit with left join fetch using distinct is incorrect
PostPosted: Thu Jan 27, 2005 3:34 pm 
Senior
Senior

Joined: Sun Oct 26, 2003 5:05 am
Posts: 139
I'm using a limit while also left join fetching a collection in the same query. If the query is supposed to return 100 values, it actually won't in reality since one is forced to filter out the duplicate results, which will obviously be less than 100.

Now, I don't expect SQL to know about this requirement, or even Hibernate actually. However, I'm curious what is the best way to solve this problem? Should I limit to 150 or 200 instead (a value chosen by design looking at the distribution of data)? If I did that, I might very well get close to 100 results after the duplicates are removed. If I queried enough results, I might have extra (like 120) and I could filter out the remaining 20 to ensure 100 results were returned each time.

Am I on the right track or is there some extra support in Hibernate that I can use to simplify the problem to a simple line of code?


Top
 Profile  
 
 Post subject:
PostPosted: Thu Jan 27, 2005 8:54 pm 
Senior
Senior

Joined: Sun Oct 26, 2003 5:05 am
Posts: 139
Well, earlier today I just scrapped the whole concept since loading 2.1 times the records just to get 100 all the time was actually slower than doing the fetch join. If you haven't been able to tell, I really hate performance testing.


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.