@Override protected void createStaticEntityMangers() throws Exception { super.createStaticEntityMangers(); TestContext ctx = TestContext.get(); emfac2 = Persistence.createEntityManagerFactory(ctx.getPersistenceUnitName() + "2"); emfac3 = Persistence.createEntityManagerFactory(ctx.getPersistenceUnitName() + "3"); em2 = emfac2.createEntityManager(); em3 = emfac3.createEntityManager(); }
/** * Any test unspecific cleaning that needs to be done. * * @throws IOException */ @AfterMethod @Override protected void testCleanup() throws Exception { super.testCleanup(); if (em2.getTransaction().isActive()) { em2.getTransaction().rollback(); } if (em3.getTransaction().isActive()) { em3.getTransaction().rollback(); } }