Cannot close EntityManager

2010-04-09 Thread Cil-Gamir
Hi I have this piece of code EntityManager em = emf.getEntityManager(); try { em.getTransaction().begin(); em.remove(kycRequestTempDocumentsToDelete); em.getTransaction().commit(); } finally { if (em != null) {

Re: Cannot close EntityManager

2010-04-09 Thread Christopher Giblin
If an exception occurs in remove(), the transaction is still open when the finally block is performed. Check whether the trans is active and roll it back if so, as in the following: } finally { if (em != null) { if (em.getTransaction().isActive()) { em.getTransaction().rollback();