Announcement Announcement Module
Collapse
No announcement yet.
retrieving primary key problem Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • retrieving primary key problem

    I am having problem to retrieve primary key after the insert statement. It seems that it works just fine when running against regular table, but when I try to run it against federated table I am getting following exception:
    org.springframework.dao.DataRetrievalFailureExcept ion: The generated key is not of a supported numeric type. Unable to cast [null] to [java.lang.Number]

    This exception is thrown in org.springframework.jdbc.support.GeneratedKeyHolde r.getKey(GeneratedKeyHolder.java:73)

    I need to retrieve generated key from the federated table during insert statement. I even try to run against different table but the same problem occurred. It seems that it doesn't like federated table much.

    Any suggestion would help,

    Thanks

  • #2
    Originally posted by ppp View Post
    I am having problem to retrieve primary key after the insert statement. It seems that it works just fine when running against regular table, but when I try to run it against federated table I am getting following exception:
    org.springframework.dao.DataRetrievalFailureExcept ion: The generated key is not of a supported numeric type. Unable to cast [null] to [java.lang.Number]

    This exception is thrown in org.springframework.jdbc.support.GeneratedKeyHolde r.getKey(GeneratedKeyHolder.java:73)

    I need to retrieve generated key from the federated table during insert statement. I even try to run against different table but the same problem occurred. It seems that it doesn't like federated table much.

    Any suggestion would help,

    Thanks
    Patient: Doctor, my arm hurts when I do this.
    Doctor: Don't do that.

    Looks like you've provided evidence that Spring JDBC support (and perhaps JDBC itself) doesn't care for federated tables.

    You don't say which relational database you're using. Could you experiment with getGeneratedKeys() using JDBC without Spring? Write a simple class that does the INSERT into your federated table and then try to getGeneratedKeys(). It could be that the driver you're using doesn't support that behavior, either. If it doesn't, Spring surely won't make up the shortfall.

    %

    Comment


    • #3
      Did you ever solve this? I am having a similar problem, however I am getting this error on a regular table but not on others.

      Comment

      Working...
      X