1

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

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 
  }    
 }

如何解决?

4

1 回答 1

1

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

于 2014-06-24T07:57:40.270 回答