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.  [ 4 posts ] 
Author Message
 Post subject: Preventing multiple queries
PostPosted: Fri Sep 08, 2006 12:54 pm 
Newbie

Joined: Fri Aug 04, 2006 6:09 am
Posts: 18
Hi,

I have set up a many-to-one mapping between my entities (Office and Country).

When i retrieve a list of Offices, I noticed that Hibernate is issuing a query per row to get the country instance.

Is there a way to get all the data in less round trips?

Cheers

R


Top
 Profile  
 
 Post subject:
PostPosted: Fri Sep 08, 2006 2:12 pm 
Senior
Senior

Joined: Sun Jun 04, 2006 1:58 am
Posts: 136
http://www.hibernate.org/hib_docs/v3/re ... mance.html

also try reading chapter 7 of HIA if you have that book

_________________
Don't forget to rate


Top
 Profile  
 
 Post subject:
PostPosted: Fri Sep 08, 2006 7:36 pm 
Senior
Senior

Joined: Sat Nov 27, 2004 4:13 am
Posts: 137
use join fetch in your HQLs, refere to documentatins.

_________________
don't forget to credit!

Amir Pashazadeh
Payeshgaran MT
پايشگران مديريت طرح
http://www.payeshgaran.co
http://www.payeshgaran.org
http://www.payeshgaran.net


Top
 Profile  
 
 Post subject:
PostPosted: Mon Sep 11, 2006 3:04 am 
Newbie

Joined: Fri Aug 04, 2006 6:09 am
Posts: 18
Hi,

thanks for that. I have tried the following:

Code:
<many-to-one name="country" column="country_id_fk" not-null="true" lazy="false" fetch="join"/>


But that has not helped. Perhaps disabling the lazy fetching is affecting the query.

Cheers

R


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 4 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.