Hi,
I'm trying to use a JpaPagingItemReader to read all records from a database that match a given criteria. What I don't understand is the relation between the parameters "commit-interval" in the tasklet and the "pageSize" in the ItemReader.
When I set both parameters to "1", then everything works fine. But when I increase the value, then records are missing in the output.
Example: I have 10 records in the DB and set both parameters to 3. Then 9 records are written corrently, but the 10th is mising.
The configuration is as follows:
(The parameter value "3" is just an example, normally I would increase the value.)Code:<batch:job id="apolloRequestDispatchJob"> <batch:step id="readNewRequests"> <batch:tasklet> <batch:chunk reader="apolloRequestReader" processor="apolloRequestProcessor" writer="apolloRequestWriter" commit-interval="3" /> </batch:tasklet> </batch:step> </batch:job> <bean id="apolloRequestReader" class="org.springframework.batch.item.database.JpaPagingItemReader"> <property name="entityManagerFactory" ref="entityManagerFactory" /> <property name="pageSize" value="3" /> <property name="queryString" value="select r from ApMbsRequest r order by r.mbRequestId asc" /> </bean>
What am I doing wrong? I'd appreciate any hints!
Cheers,
Stephan


Reply With Quote