在使用Play2开发的时候,出现以下异常
javax.persistence.PersistenceException: ManyToMany bean models.XXXXXXXX@23c0a0be does not have an Id value.
at com.avaje.ebeaninternal.server.persist.DefaultPersister.saveAssocManyIntersection(DefaultPersister.java:1045)
at com.avaje.ebeaninternal.server.persist.DefaultPersister.saveMany(DefaultPersister.java:782)
at com.avaje.ebeaninternal.server.persist.DefaultPersister.saveAssocMany(DefaultPersister.java:683)
at com.avaje.ebeaninternal.server.persist.DefaultPersister.update(DefaultPersister.java:428)
at com.avaje.ebeaninternal.server.persist.DefaultPersister.forceUpdateStateless(DefaultPersister.java:253)
at com.avaje.ebeaninternal.server.persist.DefaultPersister.forceUpdate(DefaultPersister.java:208)
at com.avaje.ebeaninternal.server.core.DefaultServer.update(DefaultServer.java:1651)
at com.avaje.ebeaninternal.server.core.DefaultServer.update(DefaultServer.java:1640)
at com.avaje.ebeaninternal.server.core.DefaultServer.update(DefaultServer.java:1617)
at com.avaje.ebean.Ebean.update(Ebean.java:548)
at play.db.ebean.Model.update(Model.java:150)
at controllers.
XXXXXXXX.update(Dishess.java:122)
at Routes$$anonfun$routes$1$$anonfun$applyOrElse$60$$anonfun$apply$60.apply(routes_routing.scala:1817)
at Routes$$anonfun$routes$1$$anonfun$applyOrElse$60$$anonfun$apply$60.apply(routes_routing.scala:1817)
at play.core.Router$HandlerInvoker$$anon$6$$anon$2.invocation(Router.scala:141)
at play.core.Router$Routes$$anon$1.invocation(Router.scala:322)
at play.core.j.JavaAction$$anon$1.call(JavaAction.scala:31)
at play.GlobalSettings$1.call(GlobalSettings.java:63)
at play.core.j.JavaAction$$anon$2.apply(JavaAction.scala:74)
at play.core.j.JavaAction$$anon$2.apply(JavaAction.scala:73)
at play.libs.F$Promise$PromiseActor.onReceive(F.java:420)
at akka.actor.UntypedActor$$anonfun$receive$1.applyOrElse(UntypedActor.scala:159)
at akka.actor.ActorCell.receiveMessage(ActorCell.scala:425)
at akka.actor.ActorCell.invoke(ActorCell.scala:386)
at akka.dispatch.Mailbox.processMailbox(Mailbox.scala:230)
at akka.dispatch.Mailbox.run(Mailbox.scala:212)
at akka.dispatch.ForkJoinExecutorConfigurator$MailboxExecutionTask.exec(AbstractDispatcher.scala:502)
at scala.concurrent.forkjoin.ForkJoinTask.doExec(ForkJoinTask.java:262)
at scala.concurrent.forkjoin.ForkJoinPool$WorkQueue.runTask(ForkJoinPool.java:975)
at scala.concurrent.forkjoin.ForkJoinPool.runWorker(ForkJoinPool.java:1478)
at scala.concurrent.forkjoin.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:104)
[error] application - XXXXXXXX.eited(64):ManyToMany bean models.XXXXXXXX@23c0a0be does not have an Id value.
记得之前是没有问题但是没有找出是什么问题,后面发现只要有记录为空。
比如:A 包含 list,list里面有些记录为空,
这下问题就出现了
解决办法:
在提交的时候用JS清除空记录,或者在服务端清除空记录。问题解决。这里记录一下.