我正在开发简单的 scala web 应用程序,我正在运行一个查询,然后 play 应用程序给出了异常
[RuntimeException: UnexpectedNullableFound(ColumnName(.SUM(score),Some(SUM(score))))]
play.api.Application$$anon$1: Execution exception[[RuntimeException: UnexpectedNullableFound(ColumnName(.SUM(score),Some(SUM(score))))]]
at play.api.Application$class.handleError(Application.scala:289) ~[play_2.10.jar:2.1.2]
at play.api.DefaultApplication.handleError(Application.scala:383) ~[play_2.10.jar:2.1.2]
at play.core.server.netty.PlayDefaultUpstreamHandler$$anonfun$18$$anonfun$apply$18.apply(PlayDefaultUpstreamHandler.scala:310) ~[play_2.10.jar:2.1.2]
at play.core.server.netty.PlayDefaultUpstreamHandler$$anonfun$18$$anonfun$apply$18.apply(PlayDefaultUpstreamHandler.scala:308) ~[play_2.10.jar:2.1.2]
at play.api.libs.concurrent.PlayPromise$$anonfun$extend1$1.apply(Promise.scala:113) ~[play_2.10.jar:2.1.2]
at play.api.libs.concurrent.PlayPromise$$anonfun$extend1$1.apply(Promise.scala:113) ~[play_2.10.jar:2.1.2]
Caused by: java.lang.RuntimeException: UnexpectedNullableFound(ColumnName(.SUM(score),Some(SUM(score))))
at scala.sys.package$.error(package.scala:27) ~[scala-library.jar:na]
at anorm.Sql$.as(Anorm.scala:535) ~[anorm_2.10.jar:2.1.2]
at anorm.Sql$class.as(Anorm.scala:453) ~[anorm_2.10.jar:2.1.2]
at anorm.SimpleSql.as(Anorm.scala:370) ~[anorm_2.10.jar:2.1.2]
at models.Keyword$$anonfun$getBlogScore$1.apply(Keyword.scala:53) ~[na:na]
at models.Keyword$$anonfun$getBlogScore$1.apply(Keyword.scala:52) ~[na:na]
模型/keyword.scala
def getBlogScore(word: String, blog: String): Long={DB.withConnection{implicit c=>
SQL("select SUM(score) from keyword where blog like {blog} and word = {word}").on('blog->blog,'word->word).as(scalar[Long].single)
}
}
我想根据某些条件获得分数列的总和。
给我一些想法来解决这个异常!