-->
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: Eager Fetching all Collections
PostPosted: Mon Oct 31, 2005 7:09 pm 
Is it possible to eagerly fetch all lazy collections related to a single object? If so, is it possible to do this using Session.Load or must you use HQL or a Critiera?

thanks,
craig


Top
  
 
 Post subject:
PostPosted: Tue Nov 01, 2005 4:00 am 
Regular
Regular

Joined: Fri Jun 11, 2004 6:27 am
Posts: 81
Location: Yaroslavl, Russia
You can explicitely initialize a collection (and a proxy) with NHibernateUtil.Initialize method.

_________________
Best,
Andrew Mayorov // BYTE-force


Top
 Profile  
 
 Post subject:
PostPosted: Tue Nov 01, 2005 4:13 am 
Contributor
Contributor

Joined: Thu May 12, 2005 9:45 am
Posts: 593
Location: nhibernate.org
Currently, you can eargerly fetch only one collection.

With HQL, you do something like:
Code:
from MyEntity e left join fetch e.MyCollection

_________________
Pierre Henri Kuaté.
Get NHibernate in Action Now!


Top
 Profile  
 
 Post subject:
PostPosted: Wed Nov 02, 2005 9:02 pm 
Regular
Regular

Joined: Tue May 24, 2005 12:55 pm
Posts: 56
Does NHibernateUtil.Initialize cascade or just act on the object or collection?


Top
 Profile  
 
 Post subject:
PostPosted: Thu Nov 03, 2005 4:15 am 
Regular
Regular

Joined: Fri Jun 11, 2004 6:27 am
Posts: 81
Location: Yaroslavl, Russia
tinomen wrote:
Does NHibernateUtil.Initialize cascade or just act on the object or collection?


AFAIK, it loads only the given collection or proxy. At the same time, if objects being loaded have relationships to other objects or non-lazy collections then everything will be loaded in the usual manner. So Initialize doesn't specially cascade, but cascading could take place.

_________________
Best,
Andrew Mayorov // BYTE-force


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.