【问题标题】:Anorm's Row object no longer exists in Play 2.3Play 2.3 中不再存在 Anorm 的 Row 对象
【发布时间】:2014-08-13 22:58:42
【问题描述】:

升级到 Play 2.3.0 后,我在对象 Row 上收到此编译错误

not found: value Row

我注意到 Row 对象在 play 2.3.0 中不再存在(我只发现了 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 
  }    
 }

如何解决?

【问题讨论】:

标签: anorm playframework-2.3


【解决方案1】:

如前所述,这种模式匹配由 https://github.com/playframework/playframework/pull/3049 在 Play master 上恢复。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2015-06-07
    • 1970-01-01
    • 1970-01-01
    • 2012-12-29
    • 1970-01-01
    • 1970-01-01
    • 2012-04-09
    • 1970-01-01
    相关资源
    最近更新 更多