Extract correct class from hibernate object wrapped with javassist
Hi,
Some times when we access domain objects of collections in one to many or many to many relationships, we get Hibernate class wrapped with javassist, basically hibernate wraps all loaded objects with javassist after loading(lazy loading case) them .
So if we call class.name
on the members of collections in one to many or many to many relationships we would get class names something like com.test.classname_javassist_59
.
So to solve this issue, hibernate provides a HibernateProxyHelper
class that has a static method to return the class without the wrapped javassist .
[java]HibernateProxyHelper.getClassWithoutInitializingProxy(object)[/java]
This method returns the class without the javassist proxy of hibernate class. If the wrappedClassObject
is not proxied by javassist the original class will be returned. 🙂
Regards
$achin verma
sachin.verma@intelligrape.com
Slick article, I’ve been interested in internet security mechanisms for a few years now.