Jul 8th, 2009, 08:56 AM
JDBC Batch Update
I'm trying to insert records in a table using batchUpdate method of JdbcTemplate. In some cases the operation may fail - due to unique key constraint for example.
In such cases I would like the method either:
1. skip the problematic items, complete inserting the remaining items and return something to convey which records where inserted/not inserted.
2. return the index of the first item that failed or something to identify the first problematic record.
batchUpdate does returns an array of the number of rows affected by each statement, however in case of an exception as the one mentioned above, one doesn't get this information.
Please let me know if there is any way to accomplish this.
Jul 16th, 2009, 10:14 AM
I have the exact same question myself.
Does anyone have any suggestions for us to try?