Package org.hibernate.test.bytecode

Examples of org.hibernate.test.bytecode.ProxyBean


    }

    //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.");
View Full Code Here

TOP

Related Classes of org.hibernate.test.bytecode.ProxyBean

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.