I am curious if anyone has configured a JpaPagingItemReader (or HibernatePagingItemReader) in a process indicator pattern. I have a dedicated PROCESSED column which the the reader scans all values of 'N' and which the processor/writer updates and commits to 'Y':
Reading up on the forum, I find conflicting responses. The thread SpringBatch and Multithreading seems to suggest a PagingItemReader can be used in a process indicator pattern, as Dave states:Code:<bean id="jpaPagingItemReader" class="org.springframework.batch.item.database.JpaPagingItemReader"> <property name="queryString" value="from WorkTable w where w.processed='N'" /> <property name="saveState" value="false" /> <property name="pageSize" value="2" /> ... </bean>
However in another thread, Records omitted from query using JpaPagingItemReader, Dave writes:By the way, you probably shouldn't use JpaItemReader in a multi-threded step unless you have a process indicator and set the saveState flag set to false
My current behavior is that of the second thread—where alternate pages are omitted from processing (on Spring Batch 2.1.9.RELEASE).You can't modify the data that the reader is consuming while the step is still active. The most common pattern is to do the updates in another step or after the step in a listener.
Thanks in advance! Any ideas most appreciated ...![]()


Reply With Quote