File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/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


Win a copy of OCM Java EE 6 Enterprise Architect Exam Guide this week in the OCMJEA forum!
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
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Fetching auto-generated primary key value after insert