I have this ItemReader:
@Bean
public JpaPagingItemReader<GWBillingDetails> itemReaderUpdPCJPA() {
JpaPagingItemReader<GWBillingDetails> reader = new JpaPagingItemReader();
reader.setName("jpaPagingUpdPCReader");
reader.setEntityManagerFactory(entityManagerFactory.unwrap(SessionFactory.class));
reader.setPageSize(10);
reader.setQueryString("Select pc from GWPaymentClaim pc INNER JOIN GWTransazioni tr ON tr.id = pc.id.idTransazione WHERE pc.kbStatus = 'SENT' AND tr.status = 'P'");
reader.setSaveState(true);
return reader;
}
In its ItemProcessor, i have some elaboration logic in which under a certain condition, it can be made an update to entity in DB. Assuming that we have 21 records read by ItemReader (so then they are divided into 3 pages by ItemReader) and only one record of first page satisfies this condition (so this record is updated), ItemReader inexplicably skips the first record on the second page. Instead if records are two, then item reader skips the first two records on the second page, etc... .
Can anyone tell me why please?