/** 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(); }
/** Constructs the EntityManager and puts it in the context. */ public void setUpEntityManager() { EntityManager em = emf.createEntityManager(); EntityManagerContext.set(em); }
/** Closes the EntityManagerFactory. */ @AfterClass public static void tearDownJPA() { EntityManagerContext.remove(); emf.close(); }
/** Closes the EntityManager and removes it from the context. */ @After public void tearDownEntityManager() { EntityManager em = EntityManagerContext.get(); EntityManagerContext.remove(); em.close(); }