TypeDoesNotMatch - BigDecimal to long on .GENERATED_KEYS?

时间:2014-12-04 22:11:00

标签: scala anorm

我试图执行插入但我收到此异常:

Caused by: java.lang.RuntimeException: TypeDoesNotMatch(Cannot convert 7: 
 class java.math.BigDecimal to Long for column ColumnName(.GENERATED_KEYS,Some(GENERATED_KEYS)))

我的插页有什么问题?

  def insertImportedFile(bean:Bean) : Option[Long] = {
    DB.withConnection("conn") { implicit connection =>
      val sqlQuery = SQL(
        """
        INSERT INTO Persons (name, group, dateCreated) 
        VALUES ({name}, {group}, {dateCreated}, )
        """
      ).on(
          "name" -> bean.name,
          "group" -> bean.group,
          "dateCreated" -> new Date
        ).executeInsert()
      return sqlQuery
    }
  }

提前感谢。

0 个答案:

没有答案