Menu

Retrieve a saved pObject's primary key

etinio
2006-03-22
2013-04-25
  • etinio

    etinio - 2006-03-22

    Hi there,

    I use some tables that auto-generate a primary key upon insert (via trigger). Now, when I perform a <table>Manager.save(pObject), how can I get back the PK?

    I cannot change the trigger, and the db is Oracle8i so I can't use getGeneratedKeys() either.

    I've tried reloading the returned pObject from the save call, but that throws "The pObject to look for is invalid : not initialized !...

    Any ideas?

     
    • Carl J. Mosca

      Carl J. Mosca - 2006-03-22

      The save returns the bean.  You should be able to retrieve the key from it.

       

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.