Results 1 to 2 of 2

Thread: Exception in reader. Not skipping. job failed

  1. #1

    Default Exception in reader. Not skipping. job failed

    I have a job def like follows:

    <property name="itemReader">
    <bean class="com.MyReader">
    <property name="itemReader" ref="headerItemReader" />
    <property name="manager" ref="myManager" />
    </bean>
    </property>

    <bean id="headerItemReader" class="org.springframework.batch.item.database.Jdb cCursorItemReader">
    <property name="dataSource" ref="dataSource" />
    <property name="mapper">
    <bean class="com.HeaderMapper" />
    </property>
    <property name="sql">
    <value>
    ${QUERY}
    </value>
    </property>
    <property name="saveState" value="false" />
    </bean>

    If any error occur in retrieving records using {QUERY}, job is failed with "unable to initialize the step" as error. Step is configured as a skippable step and it is skipping properly if any error occur in writer.

    I do not want to stop the job because of error in one record, but i want to skip the failed record and continue fetching the next record.

    Can i achieve this by anyway? Please help me.

  2. #2

    Default

    JdbcCursorItemReader runs the ${QUERY} only once and then iterates over the ResultSet to return individual items. Failing to run the ${QUERY} is therefore not an error in single record, it's an initialization failure that can't be skipped.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •