-->
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: Strange N+1 problem when using Order.desc
PostPosted: Sun Mar 06, 2011 7:05 pm 
Regular
Regular

Joined: Sun Aug 01, 2004 6:49 pm
Posts: 76
I am afraid I have come to a Hibernate bug and I am wondering if someone might have an other explanation before I try to generate a test case.
I have a class which contains a simple parent-child relation to itself. If I fetch this class via the Criteria API without any ordering (addOrder) all the entities are fetched with a single select query. The same fast response I get with an ascending ordering for any property. If I want to fetch with a descending ordering I get a N+1 selection phenomenon. Hibernate is fetching every single entity separately then. I have turned on debugging and I am familiar with diving into source of Hibernate in a debugger. But till now I did not find the clue why Hibernate is changing its fetching strategy depending on the different ordering. Do you have a tip where to look for? Which Loader is responsible for decision how to fetch?

Thanks
Thomas


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.