title: Spring batch Read/write in the same table
body: <p>I have spring batch application which reads and writes into the same table. I have used pagination for reading the items from the table as my data volume is quite high. When I set the chunk size as more than 1 then my pagination number is getting updated wrongly and hence failing to read some items from the table.
  Any idea?</p>
  
  <pre><code>@Bean
        public Step fooStep1() {
          return stepBuilderFactory.get("step1")
              .&lt;foo, foo&gt;chunk(chunkSize)
              .reader(fooTableReader())
              .writer(fooTableWriter())
              .listener(fooStepListener())
              .listener(chunkListener())
              .build();
        }
  </code></pre>
  
  <p>Reader</p>
  
  <pre><code> @Bean
   @StepScope
   public ItemReader&lt;foo&gt; fooBatchReader(){
      NonSortingRepositoryItemReader&lt;foo&gt; reader = new NonSortingRepositoryItemReader&lt;&gt;();
      reader.setRepository(service.getRepository());
      reader.setPageSize(chunkSize);
      reader.setMethodName("findAllByStatusCode");
      List&lt;Object&gt; arguments = new ArrayList&lt;&gt;(); 
      reader.setArguments(arguments);
      arguments.add(statusCode);
      return reader;
  }
  </code></pre>