SORM类强制转换异常

时间:2013-12-15 20:26:32

标签: scala playframework-2.0 sorm

我正在尝试将我的Pl​​ay框架应用程序从光滑迁移到SORM。创建了基本类,但无法使其正常工作。

case class UserAction(url: String, request: Map[String,String], ts: DateTime)

val ts = DateTime.now()
val act = Db.save(UserAction(request.uri, request.headers.toSimpleMap, ts))

但是得到以下异常:

play.api.Application$$anon$1: Execution exception[[ClassCastException: __wrapper$1$cf01f4410488416a9990d12622889a84.__wrapper$1$cf01f4410488416a9990d12622889a84$PersistedAnonymous31$1 cannot be cast to models.sorm.UserAction]]
at play.api.Application$class.handleError(Application.scala:293) ~[play_2.10.jar:2.2.1]
at play.api.DefaultApplication.handleError(Application.scala:399) [play_2.10.jar:2.2.1]
at play.core.server.netty.PlayDefaultUpstreamHandler$$anonfun$2$$anonfun$applyOrElse$3.apply(PlayDefaultUpstreamHandler.scala:261) [play_2.10.jar:2.2.1]
at play.core.server.netty.PlayDefaultUpstreamHandler$$anonfun$2$$anonfun$applyOrElse$3.apply(PlayDefaultUpstreamHandler.scala:261) [play_2.10.jar:2.2.1]
at scala.Option.map(Option.scala:145) [scala-library.jar:na]
at play.core.server.netty.PlayDefaultUpstreamHandler$$anonfun$2.applyOrElse(PlayDefaultUpstreamHandler.scala:261) [play_2.10.jar:2.2.1]

Caused by: java.lang.ClassCastException: __wrapper$1$cf01f4410488416a9990d12622889a84.__wrapper$1$cf01f4410488416a9990d12622889a84$PersistedAnonymous31$1 cannot be cast to models.sorm.UserAction
at Global$$anonfun$doFilter$1.apply(Global.scala:21) ~[classes/:na]
at Global$$anonfun$doFilter$1.apply(Global.scala:15) ~[classes/:na]
at play.api.mvc.EssentialAction$$anon$2.apply(Action.scala:61) ~[play_2.10.jar:2.2.1]
at play.api.mvc.EssentialAction$$anon$2.apply(Action.scala:60) ~[play_2.10.jar:2.2.1]
at play.core.server.netty.PlayDefaultUpstreamHandler$$anonfun$12.apply(PlayDefaultUpstreamHandler.scala:162) ~[play_2.10.jar:2.2.1]
at play.core.server.netty.PlayDefaultUpstreamHandler$$anonfun$12.apply(PlayDefaultUpstreamHandler.scala:160) ~[play_2.10.jar:2.2.1]

我做错了什么?

0 个答案:

没有答案