-->
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: simple hql generates very large number of sep sql queris
PostPosted: Tue Mar 22, 2011 12:47 pm 
Newbie

Joined: Tue Mar 22, 2011 12:31 pm
Posts: 1
I have a simple hql query which looks something like:

"from myObject obj where obj.prop = :paramValue"

This should return 1,000 - 10,000 objects.

Unfortunately this one simple hql query generates ~ 20,000 server calls (this can be seen by enabling 'show_sql' and then using db server profiler - which shows a huge number of db rpc calls (Sql server 2008). Each generates sql statement is fairly complicated.

It *appears* that NHibernate is looping through all the possible values of another of the properties of 'myObject' and executing a separate sql query for each of these possible values.

presumably there is something like a 'query planner' which is converting the hql to sql - and has decided that the 'best' way to do thi is to execute a huge number of separate queries.

Why would NHibernate do this ? - and how can it be dealt with ?


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.