Out of the box

Personal rants

Archive for the ‘Java’ Category

How to deproxy Hibernate persistent objects

leave a comment »

public static Class deproxy(Class clazz) {
    	// check if it's a cglib proxy
	if (net.sf.cglib.proxy.Proxy.isProxyClass(clazz)) {
		clazz = clazz.getSuperclass();
	}
	// check if it's cglib enhanced
	else if (net.sf.cglib.proxy.Enhancer.isEnhanced(clazz)) {
		clazz = clazz.getSuperclass();
	}
	return clazz;
}

Written by jweyrich

September 1, 2008 at 9:52 pm

Posted in Java, Programming

Follow

Get every new post delivered to your Inbox.