Package org.springframework.orm.jpa

Examples of org.springframework.orm.jpa.EntityManagerProxy


    EntityManager proxy = (EntityManager) proxyFactoryBean.getObject();
    assertSame(proxy, proxyFactoryBean.getObject());
    assertFalse(proxy.contains(o));

    assertTrue(proxy instanceof EntityManagerProxy);
    EntityManagerProxy emProxy = (EntityManagerProxy) proxy;
    try {
      emProxy.getTargetEntityManager();
      fail("Should have thrown IllegalStateException outside of transaction");
    }
    catch (IllegalStateException ex) {
      // expected
    }

    TransactionSynchronizationManager.bindResource(mockEmf, new EntityManagerHolder(mockEm));
    try {
      assertSame(mockEm, emProxy.getTargetEntityManager());
    }
    finally {
      TransactionSynchronizationManager.unbindResource(mockEmf);
    }
View Full Code Here


    EntityManager proxy = proxyFactoryBean.getObject();
    assertSame(proxy, proxyFactoryBean.getObject());
    assertFalse(proxy.contains(o));

    assertTrue(proxy instanceof EntityManagerProxy);
    EntityManagerProxy emProxy = (EntityManagerProxy) proxy;
    try {
      emProxy.getTargetEntityManager();
      fail("Should have thrown IllegalStateException outside of transaction");
    }
    catch (IllegalStateException ex) {
      // expected
    }

    TransactionSynchronizationManager.bindResource(mockEmf, new EntityManagerHolder(mockEm));
    try {
      assertSame(mockEm, emProxy.getTargetEntityManager());
    }
    finally {
      TransactionSynchronizationManager.unbindResource(mockEmf);
    }
View Full Code Here

TOP

Related Classes of org.springframework.orm.jpa.EntityManagerProxy

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.