-->
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.  [ 1 post ] 
Author Message
 Post subject: Not possible to call methods on Object when using Proxies
PostPosted: Wed Mar 24, 2010 2:26 pm 
Newbie

Joined: Tue Mar 23, 2010 10:41 pm
Posts: 9
Hello,

when i try to get an Object by using etc. session.Get<Member>(123) and Nhibernate returns a proxy instead of the "original" object (Member), then it is not possible to call methods declared on the Member Object.

I can call the method but the code in the method is never executed / hit.

Anyone have an idea why that is ?
I guess the proxy must be overriding the methods i have declared and never call my base method. But why ? Is this how it should be?

Is it a bug in the proxy ? It is hard to believe as someone else must have noticed it before me.


On my Member Object i have a method called AddEmail(Email email) which I use to set both side of a relationship between Member and Email, but it only works when it is not creating a proxy of Member.
Nhibernate only creates a proxy (Castle.Proxies.MemberProxies) of my Member object if i set a Property or Component on the Member object to be lazyloaded else it will return the "original" Member object, and everything will work just fine (but i need a component to be lazyloaded).

Hope someone out there can help me.


Best regards

Martin


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

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.