Cannot close EntityManager
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
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();