【问题标题】:Implicit Conversion error with Anorm 2.4-SNAPSHOT with simple query带有简单查询的 Anorm 2.4-SNAPSHOT 的隐式转换错误
【发布时间】:2014-10-07 02:01:17
【问题描述】:

我正在逐字尝试 Anorm 文档中的示例:

import anorm._ 

DB.withConnection { implicit c =>
  val result: Boolean = SQL("Select 1").execute()    
} 

我收到此错误:

[error] /Users/Greg/git/slurpee/src/test/scala/ReaderTests.scala:115: type mismatch;
[error]  found   : anorm.SqlQuery
[error]  required: ?{def execute: ?}
[error] Note that implicit conversions are not applicable because they are ambiguous:
[error]  both method sqlToSimple in package anorm of type (sql: anorm.SqlQuery)anorm.SimpleSql[anorm.Row]
[error]  and method sqlToBatch in package anorm of type (sql: anorm.SqlQuery)anorm.BatchSql
[error]  are possible conversion functions from anorm.SqlQuery to ?{def execute: ?}
[error]                 SQL("select 1;").execute()

这是 2.4 特有的吗?

【问题讨论】:

  • 您应该尝试使用 2.4-M1 或稳定的 2.3.4
  • 就是这样。 v2.3.5 和宣传的一样好。

标签: scala anorm


【解决方案1】:

applicius 的评论是正确的——稳定版本逐字运行。 SNAPSHOT 版本一定有问题。它发生了。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-10-24
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多