Announcement Announcement Module
Collapse
No announcement yet.
JpaPagingItemReader and resume after failure Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • JpaPagingItemReader and resume after failure

    Hi,

    Supposing I am using JpaPagingItemReader to read from a database. I have implemented chunk based processing like shown below.

    In case this job failed in the middle and I need to resume it and I want to pick up where it left off. How does it know where to begin? Is it based on the COMMIT_COUNT field of the BATCH_STEP_EXECUTION table?

    Also what if someone deleted some rows, will that throw off JpaPagingItemReader? If so then is there another Item Reader in the Spring batch aresenal that can handle this?

    Thanks,
    Jahan

    Code:
    <job id="loadAdviceJob" xmlns="http://www.springframework.org/schema/batch">
    		<step id="loadHeaderStep" >
    			<tasklet transaction-manager="jpaTransactionManager">
    				<chunk reader="AdviceHeaderReader" processor="AdviceHeaderProcessor" writer="AdviceHeaderWriter"
    					commit-interval="10" />	
    
    <bean id="AdviceHeaderReader"
    		class="org.springframework.batch.item.database.JpaPagingItemReader">
    		<property name="entityManagerFactory" ref="AS400entityManagerFactory" />
    		<property name="queryString" value="select a from Advphy01 a  " />

  • #2
    What you mean with throw off? If the page it reads doesn't have any records it'll stop the proccess.
    Yes it'll continue from the last page it was reading. Not sure right now how it does it, need to investigate that, I'm basing my answer in the docs.

    Comment


    • #3
      I mean suppose the job crashed after processing record # 885 in the table. Then before you restart it someone deleted record 775, would it know that it has to now start from record # 884 and not 885?

      Comment


      • #4
        Pagesize = ?
        AFAIK it will read the page again.

        Comment

        Working...
        X