play-authenticate icon indicating copy to clipboard operation
play-authenticate copied to clipboard

Optimistic Lock Exception

Open aakldey opened this issue 10 years ago • 1 comments

Hi, i got an issue, when i try to activate new account from email link i got this:

[error] play - Cannot invoke the action, eventually got an error: javax.persistence.OptimisticLockException: Data has changed. updated [0] rows sql[update users set email_validated=?, last_update=? where id=? and last_update=?] bind[null]
[error] application -

! @6icjpcak0 - Internal server error, for (GET) [/accounts/verify/4338be43-2a79-42d3-817d-19569a935421] ->

play.api.Application$$anon$1: Execution exception[[OptimisticLockException: Data has changed. updated [0] rows sql[update users set email_validated=?, last_update=? where id=? and last_update=?] bind[null]]]
        at play.api.Application$class.handleError(Application.scala:293) ~[play_2.10.jar:2.2.3]
        at play.api.DefaultApplication.handleError(Application.scala:399) [play_2.10.jar:2.2.3]
        at play.core.server.netty.PlayDefaultUpstreamHandler$$anonfun$3$$anonfun$applyOrElse$3.apply(PlayDefaultUpstreamHandler.scala:264) [play_2.10.jar:2.2.3]
        at play.core.server.netty.PlayDefaultUpstreamHandler$$anonfun$3$$anonfun$applyOrElse$3.apply(PlayDefaultUpstreamHandler.scala:264) [play_2.10.jar:2.2.3]
        at scala.Option.map(Option.scala:145) [scala-library.jar:na]
        at play.core.server.netty.PlayDefaultUpstreamHandler$$anonfun$3.applyOrElse(PlayDefaultUpstreamHandler.scala:264) [play_2.10.jar:2.2.3]
Caused by: javax.persistence.OptimisticLockException: Data has changed. updated [0] rows sql[update users set email_validated=?, last_update=? where id=? and last_update=?] bind[null]
        at com.avaje.ebeaninternal.server.persist.dml.DmlHandler.checkRowCount(DmlHandler.java:95) ~[avaje-ebeanorm.jar:na]
        at com.avaje.ebeaninternal.server.persist.dml.UpdateHandler.execute(UpdateHandler.java:81) ~[avaje-ebeanorm.jar:na]
        at com.avaje.ebeaninternal.server.persist.dml.DmlBeanPersister.execute(DmlBeanPersister.java:86) ~[avaje-ebeanorm.jar:na]
        at com.avaje.ebeaninternal.server.persist.dml.DmlBeanPersister.update(DmlBeanPersister.java:66) ~[avaje-ebeanorm.jar:na]
        at com.avaje.ebeaninternal.server.persist.DefaultPersistExecute.executeUpdateBean(DefaultPersistExecute.java:82) ~[avaje-ebeanorm.jar:na]
        at com.avaje.ebeaninternal.server.core.PersistRequestBean.executeNow(PersistRequestBean.java:452) ~[avaje-ebeanorm.jar:na]

If I recreate project from Git it works well for first start but next it fails again, play clean-all, reload, clean doesn't fix it

I use mysql database and I have a @Version field on my User model. The same problem was with "set last login date" and i fix it just removing this feature, but in this case i can't remove email activation, so what's the reason?

aakldey avatar May 30 '14 20:05 aakldey

I get this too. play 2.4.4 also, even though i believe i have @Version specified correctly, this is not pulled in to the where part of my update sql. I do not have this problem with update on earlier versions.

foxmike avatar Dec 08 '15 13:12 foxmike