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: how to get actual class name from proxied class
PostPosted: Fri Dec 16, 2005 6:00 pm 
Newbie

Joined: Thu Jun 02, 2005 5:45 pm
Posts: 3
when calling getName() on the class of a proxied object I get something like

com.Product$$EnhancerByCGLIB$$59f207

is there a nice way to get the real class name, that is Product in the example above?

I can easily parse the name out but we be cool if there is something in the CGLIB API or hibernate API.

thanks


Top
 Profile  
 
 Post subject:
PostPosted: Sat Dec 17, 2005 10:51 am 
CGLIB Developer
CGLIB Developer

Joined: Thu Aug 28, 2003 1:44 pm
Posts: 1217
Location: Vilnius, Lithuania
Code:
if(object instanceof HibernateProxy){

   return object.getClass().getSuperclass().getName().

}else {
   return object.getClass().getName();
}


Top
 Profile  
 
 Post subject:
PostPosted: Sat Dec 17, 2005 12:48 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
HibernateProxyHelper.getClassWithoutInitializingProxy(o)

_________________
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.  [ 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.