title: How to turn off JPA for SpringBatch under SpringBoot
body: <p>We have a Spring Boot application that uses Spring Integration and Spring Batch.  We drop a file in the poller and it processes.  This process inserts records into a database and then reads them back out does some processing and writes a file.  Let's say there are 10 records.  The first time we get 10 records read and 10 written.  Without stopping the server, we delete all the records through a SQL client on the database, run the same file again and we get 10 records read with 20 written.  I believe there is some JPA or caching going on with the datasource.  We've tried turning off several auto configuration options for JPA and caching but we haven't found the right configuration option to turn off caching.</p>
  
  <p>Adding a bit more detail to the question.</p>
  
  <p>Basically we have cron scheduler that has a FileHandler.  This the handleFile methods we have the following.</p>
  
  <pre><code>public File handleFile(File file) throws Throwable {
      JobParametersBuilder jobParametersBuilder = new JobParametersBuilder();
      Job job = (Job) appContext.getBean("processInitialFileJob");
      JobExecution jb = jobLauncher.run(job, jobParametersBuilder.toJobParameters());
      ....
  }
  </code></pre>
  
  <p>What can we do to the code above to ensure that it has a new JPA session or not use the JPA session at all?  This job needs to read from the database each time and not a cached representation of the database.</p>