-->
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: Cannot fetch join associations of components in collections
PostPosted: Thu May 20, 2004 5:21 am 
Beginner
Beginner

Joined: Fri Apr 02, 2004 1:20 pm
Posts: 23
Hi all

Is there a way to to eagerly load (fetch join) the associations of components that are in a collection? I was pretty sure there was not (and most of my searches on the forum reinforced that opinion as others seem to have had the same problem) so I filed HB-968 as a feature request but Gavin thinks it is possible and referred me back here.

For example:

select
contract
from
Contract contract
inner join fetch contract.lifesAssured
where
contract.riskStatus.code = 'PU'

This will correctly make the join to the LIFE_ASSURED table to return back the lifes assured for the contract.

However each LifeAssured has an associated client (many-to-one) and list of benefits (bag). As these are not retrieved by Hibernate in the above query so it issues (2*N)+1 queries to load them.

It would be great to be able to say something like:

select
contract
from
Contract contract
inner join fetch contract.lifesAssured
inner join fetch contract.lifesAssured.benefits
inner join fetch contract.lifesAssured.client
where
contract.riskStatus.code = 'PU'

However this syntax does not seem to be supported. Is there another way?

Thanks


Niall


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.