-->
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.  [ 6 posts ] 
Author Message
 Post subject: Problems with CGLIB enhancements and Axis
PostPosted: Mon Jan 30, 2006 4:02 pm 
Beginner
Beginner

Joined: Tue Dec 21, 2004 11:53 am
Posts: 42
Hello there! I'm using Axis to expose my services. well all my persistence strategy is done by Hibernate. It does have collections (eager loaded). But it seems that my object is still a proxy by cglib from the original one, hence I'm having problems with serializers/deserializers.

Anyone faced this before? How can I solve this?


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jan 30, 2006 5:50 pm 
CGLIB Developer
CGLIB Developer

Joined: Thu Aug 28, 2003 1:44 pm
Posts: 1217
Location: Vilnius, Lithuania
Use custom serialization, Axis supports it.


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jan 30, 2006 8:42 pm 
Beginner
Beginner

Joined: Tue Dec 21, 2004 11:53 am
Posts: 42
I'm already using it, question is how to handle those objects enhanced by CGLIB? how do I register it? not MyObject.class AFAIK...

regards


Top
 Profile  
 
 Post subject:
PostPosted: Tue Jan 31, 2006 2:12 am 
CGLIB Developer
CGLIB Developer

Joined: Thu Aug 28, 2003 1:44 pm
Posts: 1217
Location: Vilnius, Lithuania
Declare serializers dynamicaly, using Axis API if it is public. It is possible to use custom names for cglib proxies, but you will need a lot of code for custom tuplizer.


Top
 Profile  
 
 Post subject:
PostPosted: Tue Jan 31, 2006 7:01 am 
Beginner
Beginner

Joined: Tue Dec 21, 2004 11:53 am
Posts: 42
baliukas wrote:
Declare serializers dynamicaly, using Axis API if it is public. It is possible to use custom names for cglib proxies, but you will need a lot of code for custom tuplizer.


Sorry for the stupid question, but what do you mean by declaring they dinamicaly? I'm really confused with the whole thing of defining serializers for a proxy instance.

Regards


Top
 Profile  
 
 Post subject:
PostPosted: Tue Jan 31, 2006 11:47 am 
CGLIB Developer
CGLIB Developer

Joined: Thu Aug 28, 2003 1:44 pm
Posts: 1217
Location: Vilnius, Lithuania
Patch hibernate code if you can not find Axis API to customize it:


CGLIBLazyInitializer.java

Code:
public static Class getProxyFactory(final Class persistentClass, Class[] interfaces)
         throws HibernateException {
      // note: interfaces is assumed to already contain HibernateProxy.class
      
      try {

         Enhancer en = new Enhancer();
         en.setUseCache( true );
         
         en.setCallbackTypes( CALLBACK_TYPES );
         en.setCallbackFilter( FINALIZE_FILTER );
         
         en.setSuperclass( interfaces.length == 1 ? persistentClass : null );
         en.setInterfaces( interfaces );
[color=red]         en.setNamingPolicy( new NamingPolicy(){

            public String getClassName(String arg0, String arg1, Object arg2, Predicate arg3) {
               
               return persistentClass.getName() + "$HibernateProxy";
            }
            
            
         });[/color]         return en.createClass();

      }
      catch (Throwable t) {
         LogFactory.getLog( BasicLazyInitializer.class )
            .error( "CGLIB Enhancement failed: " + persistentClass.getName(), t );
         throw new HibernateException( "CGLIB Enhancement failed: " + persistentClass.getName(), t );
      }
   }


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