}
//create the object for the test
Session s = openSession();
s.beginTransaction();
ProxyBean proxyBean = new ProxyBean();
proxyBean.setSomeString("my-bean");
proxyBean.setSomeLong(1234);
s.save(proxyBean);
s.getTransaction().commit();
s.close();
// read the object as a proxy
s = openSession();
s.beginTransaction();
proxyBean = (ProxyBean) s.load(ProxyBean.class, proxyBean.getSomeString());
assertTrue(proxyBean instanceof HibernateProxy);
try {
//check that the static thread callbacks thread local has been cleared out
Field field = proxyBean.getClass().getDeclaredField("CGLIB$THREAD_CALLBACKS");
field.setAccessible(true);
ThreadLocal threadCallbacksThreadLocal = (ThreadLocal) field.get(null);
assertTrue(threadCallbacksThreadLocal.get() == null);
} catch (NoSuchFieldException e1) {
fail("unable to find CGLIB$THREAD_CALLBACKS field in proxy.");