Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow using Int type for auto-generated key in SQLUpdateWithGeneratedKey #500

Closed
unoexperto opened this issue Feb 22, 2016 · 1 comment
Closed

Comments

@unoexperto
Copy link

Just stumbled upon issue for which I couldn't find workaround. I have INT column for which SQLUpdateWithGeneratedKey fails with following exception

org.postgresql.util.PSQLException: Bad value for type long : Test user
    at org.postgresql.jdbc.PgResultSet.toLong(PgResultSet.java:3092)
    at org.postgresql.jdbc.PgResultSet.getLong(PgResultSet.java:2235)
    at scalikejdbc.DBSession$$anonfun$4.liftedTree2$1(DBSession.scala:551)
    at scalikejdbc.DBSession$$anonfun$4.apply(DBSession.scala:546)
    at scalikejdbc.DBSession$$anonfun$4.apply(DBSession.scala:534)
    at scalikejdbc.DBSession$$anonfun$updateWithFilters$1.apply(DBSession.scala:473)
    at scalikejdbc.DBSession$$anonfun$updateWithFilters$1.apply(DBSession.scala:470)
    at scalikejdbc.LoanPattern$class.using(LoanPattern.scala:18)
    at scalikejdbc.ActiveSession.scalikejdbc$DBSession$$super$using(DBSession.scala:701)
    at scalikejdbc.DBSession$class.using(DBSession.scala:30)
    at scalikejdbc.ActiveSession.using(DBSession.scala:701)
    at scalikejdbc.DBSession$class.updateWithFilters(DBSession.scala:469)
    at scalikejdbc.ActiveSession.updateWithFilters(DBSession.scala:701)
    at scalikejdbc.DBSession$class.updateAndReturnSpecifiedGeneratedKey(DBSession.scala:559)
    at scalikejdbc.ActiveSession.updateAndReturnSpecifiedGeneratedKey(DBSession.scala:701)
    at scalikejdbc.SQLUpdateWithGeneratedKey$$anonfun$10.apply(SQL.scala:598)
    at scalikejdbc.SQLUpdateWithGeneratedKey$$anonfun$10.apply(SQL.scala:598)
    at scalikejdbc.DBConnection$class.autoCommit(DBConnection.scala:222)
    at scalikejdbc.DB.autoCommit(DB.scala:60)
    at scalikejdbc.DB$$anonfun$autoCommit$1.apply(DB.scala:216)
    at scalikejdbc.DB$$anonfun$autoCommit$1.apply(DB.scala:215)
    at scalikejdbc.LoanPattern$class.using(LoanPattern.scala:18)
    at scalikejdbc.DB$.using(DB.scala:139)
    at scalikejdbc.DB$.autoCommit(DB.scala:215)
    at scalikejdbc.SQLUpdateWithGeneratedKey.apply(SQL.scala:601)

What if we add generic parameter to SQLUpdateWithGeneratedKey so client can use different types?

@unoexperto
Copy link
Author

Actually there was different issue :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

1 participant