-->
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: too many selects
PostPosted: Tue May 30, 2006 6:30 pm 
Newbie

Joined: Fri Dec 09, 2005 2:22 pm
Posts: 16
Hi,

I have two simple classes:
<class name="Country" table="codCountry" mutable="false">
<id name="Id" >
<generator class="increment" />
</id>
<version name="Version"/>
<property name="Description" />
<property name="Code" />
<many-to-one name="Currency" column="CurrencyID" not-null="true" />
</class>

and

<class name="Currency" table="codCurrency" mutable="false">
<id name="Id" >
<generator class="increment" />
</id>
<version name="Version"/>
<property name="Description" />
<property name="Code" />
</class>


when I call session.Find("From Country");
I have one SQL call for all countries and one SQL call for each currency.
What is wrong ? Why cant it be done in only one SQL call ?

thank you


Top
 Profile  
 
 Post subject:
PostPosted: Tue May 30, 2006 11:52 pm 
Newbie

Joined: Wed Oct 12, 2005 10:28 pm
Posts: 10
this is call n+ 1 select problem.

try to using session.Find("from Country c join fetch c.Currency cr");


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.