문제

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.

도움이 되었습니까?

해결책

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();
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top