Play 2.3中不再存在Anorm的Row对象 [英] Anorm's Row object no longer exists in Play 2.3

查看:96
本文介绍了Play 2.3中不再存在Anorm的Row对象的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

After upgrading to Play 2.3.0 I get this compilation error on object Row

not found: value Row

我注意到在播放2.3.0中行对象不再存在(我只找到行特征).查看文档,在Play 2.3中仍应支持模式匹配

I noticed the Row object no longer exists in play 2.3.0 (I've found only the Row trait). Looking at the documentation, pattern matching should be still supported in Play 2.3

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

请参见使用模式匹配"段落

See "Using Pattern Matching" paragraph

这是我的代码:

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

如何解决?

推荐答案

如前所述,此模式匹配通过 https://github.com/playframework/playframework/pull/3049 .

As said, this pattern matching is restored on Play master by https://github.com/playframework/playframework/pull/3049 .

这篇关于Play 2.3中不再存在Anorm的Row对象的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆