Play 2.3中不再存在Anorm的Row对象

时间:2014-06-23 19:26:33

标签: anorm playframework-2.3

升级到Play 2.3.0后,我在对象行上得到了这个编译错误

not found: value Row

我注意到在游戏2.3.0中不再存在Row对象(我只找到了Row特征)。查看文档,Play 2.3中仍应支持模式匹配

http://www.playframework.com/documentation/2.3.x/ScalaAnorm

参见"使用模式匹配"段

这是我的代码:

def findById(aId: Long) = {
  DB.withConnection { implicit conn =>
    SQL(byIdStmt).on("id" -> aId)().map {
      case Row(id:Integer, Some(userId:String), Some(description:String), 
               Some(solrCriteria:String), Some(solrCriteriaHash:String), 
               Some(hits:Integer), Some(lastPerformedUtc:java.sql.Timestamp), Some(notify:Boolean) ) => 
        new UserInquiry(id.toLong, userId, description, solrCriteria, solrCriteriaHash, 
           hits, lastPerformedUtc, notify)
    }.head 
  }    
 }

如何解决?

1 个答案:

答案 0 :(得分:1)

如上所述,此模式匹配在Play主人上由https://github.com/playframework/playframework/pull/3049恢复。

相关问题