-
Jun 18th, 2010, 01:35 AM
#1
SimpleJdbcTemplate batch insert does not return auto generated keys
Hello All,
I have been using SimpleJdbcTemplate and wanted to do a batch insert but the returned array returns the number of rows affected. Is there a way to get the auto generated keys for the batch insert ? I found a thread related to this problem but there are no replies regarding the solution for SimpleJdbcTemplate
http://forum.springsource.org/showth...t=batch+insert
Is there any work around for this problem ?
Waiting for a favorable response.
Thanks in advance.
Kind Regards.
Max
-
Jul 13th, 2010, 02:23 PM
#2
This is obviously a pretty common issue! I just posted a reply to a similar thread.
Note that the SimpleJdbcInsert constructor takes either a DataSource or a JdbcTemplate, not a SimpleJdbcTemplate (and no, SimpleJdbcTemplate and JdbcTemplate are not compatible; SimpleJdbcTemplate implements SimpleJdbcOperations and that's all). You can, however, call getJdbcTemplate() directly if you're extending SimpleJdbcDaoSupport.
Last edited by rherrick; Jul 13th, 2010 at 02:27 PM.
Reason: Added note about constructing SimpleJdbcInsert
Rick Herrick
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules