title: Where to delete the table in case of full load spring batch?
body: <p>I have batch steps, where I read the file, process the file and save it to DB. But as it is a full load, hence I have to remove the table from the DB before inserting new records.</p>
  
  <p>My question is that what place is best for writing the code to delete the existing table in spring batch (reader, processor, writer), below are the multiple scenarios:</p>
  
  <ol>
  <li><p>Do this in <code>open()</code> method of <code>ItemReader&lt;&gt;</code> in reader class: Problem: if somehow the file which I'm reading is corrupt or blank, then in that case I will end up with empty table.</p></li>
  <li><p>Create a flag, set it once and on basis of that flag delete the table in processor class: This can be done, but is there any other better way or better pace to do this</p></li>
  <li><p>Create another temp table, copy all the records from file to this table and then in ´@AfterStep´ method, delete all the records from actual table and move all the records from temp table to this table.</p></li>
  </ol>
  
  <p>Is there any method which just gets called once before the <code>Itemprocessor</code>, anything other then doing it using a flag? Please suggest</p>