In my spring batch application i am trying to update the records in Writer using JdbcTemplate batchUpdate. But niether changes are reflecting in DB nor the job gets completed. when i check in JOB_EXECUTION in spring META-TABLES EXIT_CODE shows as UNKNOWN.
List<Object[]> objects = new ArrayList<Object[]>();
for(Item item : items){
Object[] objectsArray = new Object[]{item.getName(),item.getValidToDate(),item.getAccountNo(),item.getCode()};
objects.add(objectsArray);
}
iagJdbcTemplate.batchUpdate(updateSql,objects);
And my update query is like this
UPDATE ACCOUNT_INFO SET ADDRESS= ?,DATE=? WHERE ACCOUNT=? AND CODE=?;
ACCOUNT table has composite primary key which is a combination of ACCOUNT & CODE.
NOTE : When i run the same with INSERT query it just works fine.
Please do let me know where i am going wrong.
JdbcBatchItemWriter
? – Dean ClarkMERGE
orUPSERT
statement instead? – Dean Clark