thank you very much for your information.
Also for noticing my mistake in closing the EM.
I think this could be a solution at first sight:
try {
em.getTransaction().begin();
..
em.getTransaction.commit();
} finally {
if (em.getTransaction().isActive()) em.getTransaction().rollback();
em.close();
}
However there might be an exception within the finally so, it isn't still sure. I think the only way to be sure (using transactions) inspite of the code mess should be this:
try {
em.getTransaction().begin();
..
em.getTransaction.commit();
} finally {
try {
if (em.getTransaction().isActive()) em.getTransaction().rollback();
} catch (Exception ex) { /* shallow it */ }
em.close();
}
Any comments?
[Message sent by forum member 'pucherico' (pucherico)]
http://forums.java.net/jive/thread.jspa?messageID=215973