title: Controlling commit/rollback in spring batch using JdbcBatchItemWriter
body: <p>I am using spring batch to read data form database and write it to file.<br>
  Following are the steps involved:<br>
  1. Read data from database<br>
  2. Write data to file<br>
  3. Update database rows if file write is successful.  </p>
  
  <p>According to spring batch documentation and other sources, I can use JdbcBatchItemWriter for updating database entries. But I could not find any mechanism to control commit/rollback while updating the rows.<br>
  Say there are 100 rows and an error occurs at 45th row, I need to rollback all the updates.<br>
  Is there some way in JdbcBatchItemWriter to explicitly commit or rollback the transaction?</p>
  
  <p><strong>EDIT</strong><br>
  The Itemwriter will data to file in chunks. Once a chunk is written, I need to update records in database. The database update is done using JdbcBatchItemWriter. Say 5 chunks are written successfully, and chunk 6 throws error in 45th record, I need to rollback all the chunks. Therefore I need commit/rollback control in JdbcBatchItemWriter.</p>