This week's book giveaway is in the Performance forum.
We're giving away four copies of The Java Performance Companion and have Charlie Hunt, Monica Beckwith, Poonam Parhar, & Bengt Rutisson on-line!
See this thread for details.
Win a copy of The Java Performance Companion this week in the Performance 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