Aug 21st, 2012, 01:36 PM
Spring Batch - Commit Chunk Scenario
Wondering if the following scenario is possible in Spring Batch.
The job will do the following
- Reader: Select statement (e.g. select * from tableA where status = 'READY') via JDBCcursoritemreader [say it will return 100 records)
- For each row returned we have composite writer configured
- writer1: write row data to a file
- writer2: update tableA row with status = 'PROCESSED' , Here we do not issue COMMIT for this update operation
We want the mass commit in one go to happen after all 100 records are written to the file, Is it possible? If so how do we do it?
If the mass commit is possible then is it also possible to ROLLBACK all updates?
Reason for doing this to make sure the if the Spring Batch app crashes during the job then when we re-start the spring batch app again, we are able to get the same set of data with status='READY' to be processed again.