-->
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: Fetch behaviour differences
PostPosted: Tue Aug 03, 2004 7:32 am 
Newbie

Joined: Fri May 07, 2004 5:33 am
Posts: 18
Following on from a previous thread, I'm trying to understand the apparent inconsistency in Hibernate's outer-join behaviour between <one-to-one> and <many-to-one> associations.

Take the following mapping:

<class name="Parent" table="PARENT">
........
<!--
<one-to-one name="child" class="Child"/>
<many-to-one name="child" class="Child" column="CHILD_ID"/>
-->
</class>

If I uncomment the <one-to-one>, then run the query:

session.find(from Parent");

then Hibernate will not include Child in an outer join. However, if I use the <many-to-one> approach, then Hibernate will fetch Parent and Child together in a single outer join.

I can override this by using FETCH in the query, of course, but I'm trying to change the default behaviour so that the <one-to-one> is fetched in the same way as the <many-to-one>. Why do they behave differently?


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.