-->
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: Steps to enable Proxies...
PostPosted: Tue Dec 20, 2005 12:31 am 
Newbie

Joined: Sat Oct 15, 2005 3:30 am
Posts: 17
Hi, I'm having trouble getting proxies to work:

Say I have a Grandparent/Parent/Children relationship, when I load a parent then lazy loading works in that Children are not retrieved until I access a child, but proxies dont seem to work as I am getting the Grandparent fully populated.

So far I have:

1. Ensured that all properties and methods are marked as virtual
2. Ensured that I am not using access.field
3. Ensured that I am using session.Load instead of session.Get

Am I supposed to do anything else explicitly??

Thanks in advance,

Adam.


Top
 Profile  
 
 Post subject:
PostPosted: Fri Dec 23, 2005 5:56 am 
Contributor
Contributor

Joined: Thu May 12, 2005 9:45 am
Posts: 593
Location: nhibernate.org
The obvious question is: Is GrandParent marked as Lazy?
About your "2.", do you mean that you are accessing GrandParent? (it would require its loading...)

Note that your "3." is not required.

Can you post the code you are executing and how you know that GrandParent is not lazy?

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


Top
 Profile  
 
 Post subject:
PostPosted: Fri Dec 23, 2005 6:42 am 
Contributor
Contributor

Joined: Wed May 11, 2005 4:59 pm
Posts: 1766
Location: Prague, Czech Republic
Have you marked the <class> with lazy="true"?


Top
 Profile  
 
 Post subject: Lazy=true
PostPosted: Mon Jan 09, 2006 11:39 pm 
Newbie

Joined: Sat Oct 15, 2005 3:30 am
Posts: 17
Hi,

I had missed setting Lazy="true" on the class, that fixed it.

KPixel - I am still finding that if I do a session.Load I get a proxy returned, whereas if I do a session.Get, I get the real object immediately.

Is there a mechanism to choose whether I return a proxy or not at runtime? (I guess using session.Get or session.Load is an approach...)

Thanks,

Adam.


Top
 Profile  
 
 Post subject:
PostPosted: Tue Jan 10, 2006 5:50 am 
Expert
Expert

Joined: Tue Aug 23, 2005 5:52 am
Posts: 335
Hey Adam11235,

Thay is, in fact, the prescribed approach!

Cheers,

Symon.


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.