Hi,
I have question regarding transaction management in ObjectDB.
Consider following scenario:
Thread 1:
try{ EntityManager em = emf.createEntityManager(); em.getTransaction.begin() persist object1 em.getTransaction().commit(); } catch(...){ em.getTransaction().rollback(); }
Thread 2:
try{ EntityManager em = emf.createEntityManager(); em.getTransaction.begin() persist object2 persist object1 em.getTransaction().commit(); } catch(...){ em.getTransaction().rollback(); }
Parallel running threads caused that second thread commit will fail (primary key reuse exception), the exception is caught,
but rollback fails with:
javax.persistence.TransactionRequiredException
Attempt to rollback a transaction when no transaction is active (error 611)
So the transaction seems to be already closed.
When looking into db, the transaction seems to be rollback, so when commit fails, we don't have to call rollback explicitly?
Thanks
Marta