CurrentTransaction is not working: Transaction is not active.
Closed this issue · 1 comments
jmich41 commented
For simple test in play framework 2.2 and activate framework 1.6:
def test(id:String) = Action { request =>
transactional {
byId[Vehicle](id).map { v =>
Logger.debug(s"Vehicle: ${v.name}")
v.name = v.name + "2"
currentTransaction.commit();
}
}
it throws:
play.api.Application$$anon$1: Execution exception[[IllegalStateException: Transaction is not active.]]
at play.api.Application$class.handleError(Application.scala:293) ~[play_2.10-2.2.1.jar:2.2.1]
at play.api.DefaultApplication.handleError(Application.scala:399) [play_2.10-2.2.1.jar:2.2.1]
at play.core.server.netty.PlayDefaultUpstreamHandler$$anonfun$12$$anonfun$apply$1.applyOrElse(PlayDefaultUpstreamHandler.scala:165) [play_2.10-2.2.1.jar:2.2.1]
at play.core.server.netty.PlayDefaultUpstreamHandler$$anonfun$12$$anonfun$apply$1.applyOrElse(PlayDefaultUpstreamHandler.scala:162) [play_2.10-2.2.1.jar:2.2.1]
at scala.runtime.AbstractPartialFunction.apply(AbstractPartialFunction.scala:33) [scala-library-2.10.3.jar:na]
Caused by: java.lang.IllegalStateException: Transaction is not active.
at net.fwbrasil.radon.transaction.TransactionManager.deactivate(TransactionManager.scala:34) ~[radon-stm_2.10-1.6.jar:1.6]
at net.fwbrasil.radon.transaction.TransactionManager.runInTransaction(TransactionManager.scala:58) ~[radon-stm_2.10-1.6.jar:1.6]
at net.fwbrasil.radon.transaction.TransactionManager.runInTransactionWithRetry(TransactionManager.scala:69) ~[radon-stm_2.10-1.6.jar:1.6]
at net.fwbrasil.radon.transaction.TransactionManager.runInNewTransactionWithRetry(TransactionManager.scala:62) ~[radon-stm_2.10-1.6.jar:1.6]
at net.fwbrasil.radon.transaction.Required.execute(Propagation.scala:26) ~[radon-stm_2.10-1.6.jar:1.6]
fwbrasil commented
The transactional block commits the transaction automatically in the end. Why are you trying to commit it manually?
Pleas use the manual transaction control if needed: