Exemplo n.º 1
0
 /** Constructs the EntityManager and puts it in the context. */
 @Before
 @Override
 public void setUp() {
   logger.info("Setting up JPA test support.");
   EntityManager em = emf.createEntityManager();
   EntityManagerContext.set(em);
   super.setUp();
 }
Exemplo n.º 2
0
 /** Constructs the EntityManager and puts it in the context. */
 public void setUpEntityManager() {
   EntityManager em = emf.createEntityManager();
   EntityManagerContext.set(em);
 }
Exemplo n.º 3
0
 /** Closes the EntityManagerFactory. */
 @AfterClass
 public static void tearDownJPA() {
   EntityManagerContext.remove();
   emf.close();
 }
Exemplo n.º 4
0
 /** Closes the EntityManager and removes it from the context. */
 @After
 public void tearDownEntityManager() {
   EntityManager em = EntityManagerContext.get();
   EntityManagerContext.remove();
   em.close();
 }