1

Im my chunk processing ,I have read one value from file and in my processor im passing this value to the DB , that will return 4 records for that single value. And im returning 4 records to the writer which is going to write in the DB . I'm failing the job in the 3rd record which is returned for the value read from the file. But after failing the job, 3 records from the DB is not rollbacked?

How the chunk is maintaining the transaction whether it is based on read count and write count of the record or not?

TELMILA
  • 83
  • 9
  • you need to mention your job configuration and are you using JdbcBatchItemWriter, if so commit-interval size have a big role to maintain transaction (after how many record it would commit). but i think you need to write your custom writer where you will have more choice to handle your transactions..if you have already written your custom writer, paste your code here.. – surya Apr 29 '16 at 22:58
  • I have commit interval as 4. But for single value it self im getting 4 records from the table. im iterating 4 records in the custom writer. – TELMILA May 03 '16 at 11:06
  • for(Object item: empDO.getReportList()) {List itemList = new ArrayList(); itemList.add(item); super.writeItems(itemList); } Im not handling any transaction here.spring will consider read and write count in transaction? – TELMILA May 03 '16 at 11:57
  • May be you can refer http://stackoverflow.com/questions/7025506/spring-batch-commit-interval-not-honored-after-roll-back-during-write – surya May 03 '16 at 22:40
  • In a chunk processing, if a records fails in a chunk, then spring tries to find the erroneous record and works with commit-interval =1 and may skip the error record while committing other record.(Though you can customize these behaviors). – surya May 03 '16 at 22:43

0 Answers0