-->
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: outer-join fetch on list?
PostPosted: Tue May 11, 2004 4:32 pm 
Regular
Regular

Joined: Tue Jan 06, 2004 3:32 pm
Posts: 80
Location: Munich, Germany
Could it be that outer-join fetches are not supported on lists?

I am using a construct like

<list
name="players"
inverse="true"
cascade="all"
outer-join="true"
>
<cache
usage="nonstrict-read-write"
/>

<key
column="game_id"
/>

<index
column="position"
/>

<one-to-many
class="de.schildbach.game.business.GamePlayer"
/>
</list>

but the association is still fetched in a seperate SQL statement.

I am using the MySQLDialect with MySQL 4.0.18 and Hibernate 2.1.3.

Here are my Hibernate properties (taken from a Spring application context):

<property name="hibernateProperties">
<props>
<prop key="hibernate.connection.isolation">4</prop>
<prop key="hibernate.max_fetch_depth">1</prop>
<prop key="hibernate.show_sql">true</prop>
<prop key="hibernate.dialect">net.sf.hibernate.dialect.MySQLDialect</prop>
<prop key="hibernate.cache.use_query_cache">false</prop>
<prop key="hibernate.query.substitutions">true 1, false 0, yes 'Y', no 'N'</prop>
<prop key="hibernate.cache.provider_class">net.sf.ehcache.hibernate.Provider</prop>
</props>
</property>

Regards,

Andreas


Top
 Profile  
 
 Post subject:
PostPosted: Tue May 11, 2004 4:33 pm 
Hibernate Team
Hibernate Team

Joined: Thu Dec 18, 2003 9:55 am
Posts: 1977
Location: France
try to fetch it explicitly in the query
select a from A as a left fetch join a.players


Top
 Profile  
 
 Post subject:
PostPosted: Tue May 11, 2004 4:40 pm 
Hibernate Team
Hibernate Team

Joined: Mon Aug 25, 2003 9:11 pm
Posts: 4592
Location: Switzerland
Outer fetching is supported for lists, however, the eager and lazy fetching behavior depends on the query method you are using:

- Navigating/walking the object graph uses the fetching strategies defined in the mapping files
- Retrieval by identifier (get and load) use these default fetching strategies
- HQL _ignores_ any default fetching strategy, as it is used to define a _runtime_ fetching strategy
- Criterial does _not_ ignore the fetching strategies, but can also be used with a different runtime fetching strategy (FetchMode)

_________________
JAVA PERSISTENCE WITH HIBERNATE
http://jpwh.org
Get the book, training, and consulting for your Hibernate team.


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.