aspose file tools*
The moose likes Spring and the fly likes Fetching auto-generated primary key value after insert Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Spring
Bookmark "Fetching auto-generated primary key value after insert " Watch "Fetching auto-generated primary key value after insert " New topic
Author

Fetching auto-generated primary key value after insert

Chetan Parekh
Ranch Hand

Joined: Sep 16, 2004
Posts: 3636
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?

My blood is tested +ve for Java.
Chetan Parekh
Ranch Hand

Joined: Sep 16, 2004
Posts: 3636
I found the solution here
 
wood burning stoves
 
subject: Fetching auto-generated primary key value after insert