-->
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.  [ 4 posts ] 
Author Message
 Post subject: Multiple fetching
PostPosted: Mon Oct 25, 2004 5:45 am 
Newbie

Joined: Mon Oct 25, 2004 5:16 am
Posts: 2
Hibernate version:
2.1.6

Code between sessionFactory.openSession() and session.close():
run the query only

Full stack trace of any exception that occurs:
No exception

Name and version of the database you are using:
Mysql

I have a class with, let's say, 3 one-to-many collections.
How can I retrieve the the 3 collections together with the parent object in one query? This should be done with FETCH, but I find that one query can use with ONE fetch only. Any suggestion is welcome.

Thanks in advance.


Top
 Profile  
 
 Post subject:
PostPosted: Mon Oct 25, 2004 10:13 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 3:00 pm
Posts: 1816
Location: Austin, TX
Quote:
but I find that one query can use with ONE fetch only

Sounds like you answered your own question :) Perhaps you just didn't like the answer...

Only a single collection association can be fetched at a time.

There are other ways to do it. There was a post just last week about how to approximate this behavior.


Top
 Profile  
 
 Post subject:
PostPosted: Mon Oct 25, 2004 7:22 pm 
Pro
Pro

Joined: Tue Aug 26, 2003 8:07 pm
Posts: 229
Location: Brisbane, Australia
Steve, you mean this one?
http://forum.hibernate.org/viewtopic.php?t=935555

(I'm trying to collect a bunch of different ways of doing this and some other tricky things that people keep messing up in our project. So if this is one of the accepted ways of querying multiple one-to-many collections, I want to put it in our doco).

_________________
Cheers,
Shorn.


Top
 Profile  
 
 Post subject: Thanks for all your help
PostPosted: Mon Oct 25, 2004 11:24 pm 
Newbie

Joined: Mon Oct 25, 2004 5:16 am
Posts: 2
For honesty, I do prefer multiple-fetch as it seems to be essential and basic to most of the proj in the world ( I strongly believe that )


Compare to set everyting non-lazy, multiple-fetch is much more practical and fleasible.

Anyway, thanks a lot.


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