【问题标题】:get java.math.BigInteger from executeInsert() using Anorm in scala在 scala 中使用 Anorm 从 executeInsert() 获取 java.math.BigInteger
【发布时间】:2013-10-10 06:02:38
【问题描述】:

问题是 executeInsert 返回 Long 类型结果但我希望 executeInsert 返回结果的 java.math.BigInteger 类型。因为,数据库中的 userId 是 20 位长。 现在,我正在尝试使用 ResultSetParser 将 executeInsert 结果解析为 java.math.BigInteger。 谁能写出解决方案:

val id=SQL(
  """
    INSERT INTO registration(userId,name) 
       VALUES (1,"sam")
  """
).executeInsert();

【问题讨论】:

    标签: scala playframework playframework-2.0 anorm


    【解决方案1】:

    是的。!!我找到了解决方案。它有效:

    val id=SQL(
      """
    INSERT INTO registration(userId,name) 
       VALUES (1,"sam")
      """
    ).executeInsert(scalar[BigInteger].single);
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-11-30
      • 2013-10-20
      • 2015-06-07
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多