-->
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.  [ 5 posts ] 
Author Message
 Post subject: fetch join
PostPosted: Fri Jan 16, 2004 10:20 am 
Senior
Senior

Joined: Sun Jan 04, 2004 2:46 pm
Posts: 147
Quote:
Note that, in the current implementation, only one collection role may be fetched in a query.


I found this in the doco ( 10.3 ) in the fetch join section. Does this mean I can't fetch multiple collections of the same object type like this?

Code:
from eg.Cat as cat
    join cat.mate as mate
    left join cat.kittens as kitten


or does it mean I can't have more than one parent object fetching it's collections in a single query like this?

Code:
from eg.Cat as cat, eg.Mouse as mouse
    join cat.mate as cat_mate
    join mouse.mate as mouse_mate


Or something else.

Cheers.

Myk.


Top
 Profile  
 
 Post subject:
PostPosted: Fri Jan 16, 2004 10:25 am 
Hibernate Team
Hibernate Team

Joined: Tue Sep 09, 2003 2:10 pm
Posts: 3246
Location: Passau, Germany
You can join multiple collections, but not fetch join multiple collections.


Top
 Profile  
 
 Post subject:
PostPosted: Fri Jan 16, 2004 10:37 am 
Senior
Senior

Joined: Sun Jan 04, 2004 2:46 pm
Posts: 147
Oops my bad I posted the wrong query code. The first should have been this.

Code:
from eg.Cat as cat
    inner join fetch cat.mate
    left join fetch cat.kittens


second should be this...

Code:
from eg.Cat as cat, eg.Mouse as mouse
    inner join fetch cat.mouse_mate
    inner join fetch mouse.mouse_mate


Note the first is in the doco so perhaps it should be amended if hibernate does not do multiple collection fetches on a single object?

Cheers.

Myk.


Top
 Profile  
 
 Post subject:
PostPosted: Fri Jan 16, 2004 10:41 am 
Senior
Senior

Joined: Sun Jan 04, 2004 2:46 pm
Posts: 147
Doh again wrong. The example is fine as it is, one is a single object reference ( mate ) the other is a collection ( kittens ).


Top
 Profile  
 
 Post subject:
PostPosted: Fri Jan 16, 2004 1:37 pm 
Hibernate Team
Hibernate Team

Joined: Sun Sep 14, 2003 3:54 am
Posts: 7256
Location: Paris, France
All of these works, because there is only 1 fetched collection (kittens). mate isn't a collection but a *-to-one

_________________
Emmanuel


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