2

This code is a version of Spring Batch version 1. I have problem migrating this code to version 4 since the org.springframework.batch.item.database.IbatisDrivingQueryItemReader class is no longer available in current version.

The process of the code below is, the withdrawalIbatisKeyGenerator bean should execute first and from the output of that bean, it will use in ibatisWithdrawalReader bean.

My question is, how to implement this reader to current version, since the two bean have dependency with each other.

<bean id="ibatisWithdrawalReader"
        class="org.springframework.batch.item.database.IbatisDrivingQueryItemReader">
        <property name="detailsQueryId"
            value="withdrawalTransactionDao.getWithdrawalTransaction" />
        <property name="sqlMapClient" ref="sqlMap" />
        <property name="keyCollector"
            ref="withdrawalIbatisKeyGenerator" />
    </bean>



<bean id="withdrawalIbatisKeyGenerator"
        class="ph.pnblife.julia.batch.BatchKeyCollector">
        <property name="drivingQuery"
            value="withdrawalTransactionDao.getWithdrawalTransactionKey" />
        <property name="restartQueryId"
            value="withdrawalTransactionDao.restartWithdrawalTransaction" />
        <property name="sqlMapClient" ref="sqlMap" />
        <property name="parameters">
            <list>
                <value>%%pricing_date_ibatis:date:pricing_date</value>
                <value>%%policy_number:string:pol_no</value>
                <value>%%version_no:string:version_no</value>
                <value>%%start_date:date:start_dt</value>
                <value>%%endt_type:string:endt_code</value>
            </list>
        </property>
        <property name="isKeyAMap">
            <value type="java.lang.Boolean">true</value>
        </property>
    </bean>

1 Answer 1

2

The withdrawalIbatisKeyGenerator bean could registered as a StepExecutionListener where the data required by the reader is generated in the StepExecutionListener#beforeStep method.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.