Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Fetching auto-generated primary key value after insert

 
Chetan Parekh
Ranch Hand
Posts: 3640
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
We are using JDBCTemplate for JDBC connectivity. Following is our insert query

insert into MyTable (Column2,Column4,Column4) values (?,?,?)

MyTable has primary key Column1 and it is a auto-generated. We need to fetch the value of Column1 after we insert record using above query.

How to achieve this?
 
Chetan Parekh
Ranch Hand
Posts: 3640
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I found the solution here
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic