Pregunta

How to enable MySQL auto commit in play 1.2.4?

I can find the auto commit in play 2.0 I tried using db.default.autocommit but in vain. Also through code i.e. setAutoCommit(true) but there was an exception while JPA tried to commit the transaction Please help.

¿Fue útil?

Solución

PLay will commit automatically at the end of a transaction. If you need to commit within the transaction try something like this:

if (JPA.em().getTransaction().getRollbackOnly()) {
    JPA.em().getTransaction().rollback();
} else {
    JPA.em().getTransaction().commit();
}
JPA.em().getTransaction().begin();
JPA.em().flush();
JPA.em().clear();
Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top