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.  [ 2 posts ] 
Author Message
 Post subject: How to load a collection of proxies?
PostPosted: Tue Jun 10, 2008 6:01 am 
Newbie

Joined: Sun Jun 08, 2008 9:58 pm
Posts: 3
NHibernate 1.2GA

I want to load a collection of proxy objects based on a query.
The documentation seems to sugest that the Enumerable method returns proxies but I tried IQuery.Enumerable() but it didn't seem to work.
What i would like is to be able to do somthing like:

IQuery q = session.CreateQuery("......");
List<MyEntity> = q.List<MyEntity>();

and up with collection of lazy loaded proxies. Can it be done?


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jun 16, 2008 11:11 am 
Senior
Senior

Joined: Thu Jun 21, 2007 8:03 am
Posts: 127
Location: UK
Hi,

I think NHibernate only uses proxies when it needs to. If your class is set to 'lazy' (the default), then issuing a session.Load<MyObject>(id); will most often return a proxy.

If NHibernate has all the information to populate a complete object (for example if you simply query a table) it will create a regular object (since no proxy is required).

Does that help?

Regards,
Richard


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