-->
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.  [ 3 posts ] 
Author Message
 Post subject: one-to-one with outer join two many SQL statements
PostPosted: Thu Nov 23, 2006 4:43 am 
Newbie

Joined: Thu Nov 23, 2006 4:32 am
Posts: 3
Hello,

I have a problem that seems to have already been identified but with no answer.

I have a parent object with 5 child objects in one-to-one relationships. I want to load the parent and the 5 childs in one SQL request.
So I set fetch=join on the 1-1 relationships in the parent mapping file.

When I call Initialize() or when I access the parent object I see that there is one SQL statement with all the outer-join in it and this can initialize all objects. However NHibernate also issue 5 select on the child tables.

Is this behavior normal ?
Is there something missing in my mapping file ?

Ex of mapping of 1-1 in the parent:
<one-to-one name="Child1"
class="blablabla"
property-ref="ParentPropInChild"
cascade="all" lazy="proxy"
fetch="join" />

Thanks a lot,
Florent


Top
 Profile  
 
 Post subject:
PostPosted: Thu Nov 23, 2006 8:29 pm 
Senior
Senior

Joined: Sat Nov 27, 2004 4:13 am
Posts: 137
well that's just because of lazy="proxy", cause that forces hibernate to create a proxy for the referenced object, and the proxy would be initialized on first access to accessor methods....

_________________
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 Nov 27, 2006 12:33 pm 
Newbie

Joined: Thu Nov 23, 2006 4:32 am
Posts: 3
Well I thought it was like the outer-join="true" in the one-to-many that makes the proxies beeing initialized at once in one SQL request.

And if it-s not the case what's the use of fetch=join ? Why select all tables in one request if it is to select the same joined tables again one by one ?

Florent


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