title: Spring Batch File Writer Exception handling
body: <p>I have a Spring Batch process which has following kind of code.</p>
  
  <pre><code>&lt;step id="step1" xmlns="http://www.springframework.org/schema/batch"&gt;
          &lt;tasklet allow-start-if-complete="true"&gt;
              &lt;chunk reader="reader1" writer="writer1" commit-interval="10"/&gt;
          &lt;/tasklet&gt;
      &lt;/step&gt;
  
  &lt;bean id="writer1" class="org.springframework.batch.item.file.FlatFileItemWriter"&gt;
      &lt;property name="resource" ref="resourceFlatFile" /&gt;   
      &lt;property name="shouldDeleteIfExists" value="true" /&gt;
      &lt;property name="transactional" value="true" /&gt;
      &lt;property name = "lineAggregator"&gt; 
          &lt;bean class="org.springframework.batch.item.file.transform.DelimitedLineAggregator" &gt;
              &lt;property name="delimiter" value=""/&gt;
              &lt;property name ="fieldExtractor"&gt; 
                  &lt;bean class="com.path.MyExtractor" /&gt;
              &lt;/property&gt;  
          &lt;/bean&gt;
      &lt;/property&gt; 
  &lt;/bean&gt; 
  </code></pre>
  
  <p>Basically my reader gives set of records from database. My writer (writer1) writes it to a flat file. If there is any problem in writing a record to the file, I would like to mark that record status as failed in database. So how to handle these kind of scenarios? Any help is appreciated.</p>
  
  <p>Thanks
  My question is if I get any kind of exception</p>