-->
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.  [ 3 posts ] 
Author Message
 Post subject: force proxy load
PostPosted: Thu Jun 28, 2007 6:35 pm 
Newbie

Joined: Tue Mar 27, 2007 4:45 pm
Posts: 9
Hello everybody,

for my internal logging system I'm heavily using the reflection methods to gather the updated property values. Unfortunately when it comes across to an object that has as property another NHibernated-object (e.g. via <many-to-one>) my procedure fails because it is usually a proxy.

Therefore: Is there some way I can force a proxy to return the "real" object or at least the id-value of it?


Top
 Profile  
 
 Post subject:
PostPosted: Fri Jun 29, 2007 1:21 am 
Contributor
Contributor

Joined: Wed May 11, 2005 4:59 pm
Posts: 1766
Location: Prague, Czech Republic
There is (at least should be) no way to get the real object. To get the ID you can use ISession.GetIdentifier() or just access the identifier property of the proxy.


Top
 Profile  
 
 Post subject:
PostPosted: Tue Jul 03, 2007 7:17 pm 
Expert
Expert

Joined: Fri Oct 28, 2005 5:38 pm
Posts: 390
Location: Cedarburg, WI
Are you using reflection to read private field values? If you read the public, mapped properties instead of private fields, it should make no difference whether you're doing so on a proxy or not. If you are concerned with initializing proxies unnecessarily, you can check if the object is an uninitialized proxy, and if so, you can assume that no properties are modified (otherwise the proxy would have initialized itself when a property value was set).


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