-->
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.  [ 14 posts ] 
Author Message
 Post subject: CGLIBLazyInitializer does not proxy package private methods
PostPosted: Wed Apr 06, 2005 5:01 am 
Beginner
Beginner

Joined: Mon Nov 08, 2004 11:58 am
Posts: 29
I have an object that contains a collection mapping (set, one-to-many).
This object itself is cached and referenced by others in a many-to-one.

It all works when the object is not in the cache. If it is in the cache, the many-to-one only contains a Proxy (CGLIBLazyInitializer ), which is all well. unfortunatelly the proxy does not seem to take care of the the mentioned collection, which has package private setter/getter.

I assume this is a bug, because hibernate itself does support private setter/getters.


Top
 Profile  
 
 Post subject:
PostPosted: Wed Apr 06, 2005 5:57 am 
CGLIB Developer
CGLIB Developer

Joined: Thu Aug 28, 2003 1:44 pm
Posts: 1217
Location: Vilnius, Lithuania
Change this method to public for test, package methods must be intercepted in the same way as public methods (proxy is defined in the same package as domain class).


Top
 Profile  
 
 Post subject:
PostPosted: Wed Apr 06, 2005 5:58 am 
Beginner
Beginner

Joined: Mon Nov 08, 2004 11:58 am
Posts: 29
I already changed it to public and it works now. So this is indeed a bug.


Top
 Profile  
 
 Post subject:
PostPosted: Wed Apr 06, 2005 7:18 am 
CGLIB Developer
CGLIB Developer

Joined: Thu Aug 28, 2003 1:44 pm
Posts: 1217
Location: Vilnius, Lithuania
probably it is a bug in some cglib version, I just changed all methods to package in "ProxyTest" (I use Hibernate3 head for this test). It fails on "get/set ID", but it is a different problem.
Try to upgrage cglib, "CGLIBProxy" implementation doe's not filter methods by access modifiers.


Top
 Profile  
 
 Post subject:
PostPosted: Wed Apr 06, 2005 7:27 am 
Beginner
Beginner

Joined: Mon Nov 08, 2004 11:58 am
Posts: 29
I currently use Hibernate 3 final, which means cglib 2.1.
That is the last version to my knowledge


Top
 Profile  
 
 Post subject:
PostPosted: Wed Apr 06, 2005 10:40 am 
CGLIB Developer
CGLIB Developer

Joined: Thu Aug 28, 2003 1:44 pm
Posts: 1217
Location: Vilnius, Lithuania
Submit test case to jira, probably I am trieng to reproduce it in a wrong way. (I see proxy intercepts package methods in this version)


Top
 Profile  
 
 Post subject:
PostPosted: Wed Apr 06, 2005 10:57 am 
CGLIB Developer
CGLIB Developer

Joined: Thu Aug 28, 2003 1:44 pm
Posts: 1217
Location: Vilnius, Lithuania
It can be related to this code in ReflectHelper, private id doe's not work for this reason too :

Code:
public static Method getMethod(Class clazz, Method method) {
      try {
         return clazz.getMethod( method.getName(), method.getParameterTypes() );
      }
      catch (Exception e) {
         return null;
      }
   }


Top
 Profile  
 
 Post subject:
PostPosted: Tue Apr 12, 2005 5:25 am 
Beginner
Beginner

Joined: Mon Nov 08, 2004 11:58 am
Posts: 29
Dumb Question, is this the jira of Hibernate or where can I find it?


Top
 Profile  
 
 Post subject:
PostPosted: Tue Apr 12, 2005 5:29 am 
Beginner
Beginner

Joined: Mon Nov 08, 2004 11:58 am
Posts: 29
BTW, I use Java5, can that be the reason?


Top
 Profile  
 
 Post subject:
PostPosted: Tue Apr 12, 2005 6:13 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
baliukas wrote:
It can be related to this code in ReflectHelper, private id doe's not work for this reason too :

Code:
public static Method getMethod(Class clazz, Method method) {
      try {
         return clazz.getMethod( method.getName(), method.getParameterTypes() );
      }
      catch (Exception e) {
         return null;
      }
   }


is this something we need to react/fix ? what should it do instead ?

_________________
Max
Don't forget to rate


Top
 Profile  
 
 Post subject:
PostPosted: Tue Apr 12, 2005 7:15 am 
CGLIB Developer
CGLIB Developer

Joined: Thu Aug 28, 2003 1:44 pm
Posts: 1217
Location: Vilnius, Lithuania
"clazz.getMethod" return public methods only, I see this problem exists with id, but I can not reproduce any problem with attribute getter/setter


Top
 Profile  
 
 Post subject:
PostPosted: Tue Apr 12, 2005 7:28 am 
CGLIB Developer
CGLIB Developer

Joined: Thu Aug 28, 2003 1:44 pm
Posts: 1217
Location: Vilnius, Lithuania
I modified "DataPoint" class to test it, probably it is too trivial to reproduce this problem. Submit some class with problem to jira, it must be something trivial.


Top
 Profile  
 
 Post subject:
PostPosted: Tue Apr 12, 2005 7:29 am 
Beginner
Beginner

Joined: Mon Nov 08, 2004 11:58 am
Posts: 29
brings me again to the question, which jira? the cglib sourceforge page only refers to the sourceforge tracker? Do you mean hiberantes jira?


Top
 Profile  
 
 Post subject:
PostPosted: Tue Apr 12, 2005 8:15 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
its hibernates jira http://www.hibernate.org/217.html

_________________
Max
Don't forget to rate


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