I use Play Framework 2.3.4, Java8, Ebean. The EBI transaction code is not working. Please help you.
Java code
Ebean.execute (new TxRunnable () {public zero run} {user user = new user (); user.id = 1; user ();}});
server error log
at play.api.application $$ $ 1: execution exception [[illegal exception: transaction is inactive]] play On .api Application $ class.handleError (application.scala: 296) ~ [com.typesafe.play.play_2.11-2.3.4.jar: 2.3.4] at play.api.DefaultApplication.handleError (application.scala: 402) [ Com.typesafe.play.play_2.11-2.3.4.jar: 2.3.4] play.core.server.netty.PlayDefaultUpstreamHandler $$ $ $ $ $ 3 $ $ Annuf to $ apply Krenanu $ 4.apply (PlayDefaultUpstreamHandler. Scala: 320) [Com.typesafe.play.play_2.11-2.3.4.jar: 2.3.4] play.core.server.netty.PlayDefaultUpstreamHandler $$ $ $ $ $ 3 $ $Ennify $ Apply $ 4 .apply (PlayDefaultUpstreamHandler.scala: 320) [Com.typesafe.play.play_2.11-2.3.4.jar: 2.3.4] scala.Option.map (Option.scala: 145) [org.scala-lang. scala-library-2.11.1.jar: No] by: java.lang.IllegalStateException: transaction passive com.avaje.ebeaninternal.server.transaction.JdbcTransaction.commit (JdbcTransacti on.javaitter83) ~ [Org.avaje.ebianorm.avaje-ebeanorm-3.34.jar: na] on com.avaje.ebeaninternal.api.ScopeTrans.onFinally (ScopeTrans.java:101) ~ [org.avaje.ebeanorm.avaje - Ebeanorm-3.3.4.jar: na] on com.avaje.ebeaninternal.server.core.DefaultServer.execute (DefaultServer.java:724) ~ [org.avaje.ebeanorm.avaje-ebeanorm-3.3.4.jar: No] on Com.avaje.ebeaninternal.server.core.DefaultServer.execute (DefaultServer.java:709) ~ [org.avaje.ebeanorm.avaje-ebeanorm-3.3.4.jar: na] com.avaje.ebean.ebian On .execute (Ebean.java1264) ~ [org.avaje.ebeanorm.avaje-ebeanorm-3.34.jar: na]
Thanks.
Provide scope of transactions
TxScope txScope = TxScope.requiresNew (); Ebean.execute (txScope, new TxRunnable () {public zero run ()} user user = new user (); user.id = 1; user.save ();}});
No comments:
Post a Comment