-->
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: CGLIBLazyInitializer intercept method question
PostPosted: Tue Mar 15, 2005 7:08 pm 
Regular
Regular

Joined: Fri Oct 01, 2004 2:19 am
Posts: 111
Location: Melbourne, Australia
Hibernate version: 3.0b4, 3.0rc1

I'm trying to understand how the CGLIB proxies work since I'm having issues with collections and lazily initialised objects.

Having a look at the intercept() method, I can see that the invoke() method of the
superclass is called and when it returns INVOKE_IMPLEMENTATION, the method is then invoked on the actual (target) object, not the proxy, which
is to be expectd. However, if the one of the arguments is the the proxy instance itself, it does not get changed to the target object. So, in the
following example pseudocode which invokes the equals method on an instance of a class that overrides equals()

Code:
PeristentObject p = getPersistentInstance(); // some method which returns a proxy
PeristentObject p2 = p;
boolean eq = p.equals(p2); // or p.equals(p) for that matter

the PersistentObject method is called on the target of p (p.target), but is being passed p as an argument. After the call, eq is false.

This is where my confusion begins: the argument p, which is an instance of an enhanced PersistentObject has whatever fields PersistentObject has,
as well as a target member which is the real object. The fields in the proxy instance, however, do not seem to be initialised and so, in the
method call above, the two objects are not deemed equal, which I think is the wrong result.

My question is then: should the intercept() method implementation check for this case and replace the argument with the target object? perhaps at least for the equals()
method since it is already treated as a special case?

_________________
Cheers,

Bonny

please don't forget to rate :)


Top
 Profile  
 
 Post subject:
PostPosted: Wed Mar 16, 2005 3:44 am 
CGLIB Developer
CGLIB Developer

Joined: Thu Aug 28, 2003 1:44 pm
Posts: 1217
Location: Vilnius, Lithuania
You are right, this is a bug. I will send a patch.


Top
 Profile  
 
 Post subject:
PostPosted: Fri May 12, 2006 4:54 pm 
Beginner
Beginner

Joined: Tue Oct 28, 2003 12:09 pm
Posts: 46
Any news on a patch for this? I'm having similar problems with hib 2.1.8 (and whatever version of cglib comes with that)

Or is there a bug report I can follow until a patch is rolled?


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.