Announcement Announcement Module
No announcement yet.
Using parameterized sql with Itemreader Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • Using parameterized sql with Itemreader

    I am doing a prototype with springbatch on websphere using mysql. The sql for the itemreader is a parameterized sql. This works if it the parameter value is a string. But if it is a the outcome of a static method, it fails. Any help will be really appreciated.
    I have used the JdbcPagingItemReader bcoz the JdbcCursorItemReader does not work with websphere and there was in one of the spring batch forums.

    So, if I reference it to a ref bean which is also defined in the configuration, it does not work. It also does not throw any error messages. It just finishes up doing nothing with the message status=COMPLETED.

    <bean id="testItemReader"
    class="org.springframework.batch.item.database.Jdb cPagingItemReader">
    <property name="dataSource" ref="dataSource" />
    <property name="queryProvider" ref="testQueryProvider" />
    <property name="rowMapper">
    <bean class="gov.irs.cade2.web.TestMapper" />
    <property name="parameterValues">
    <entry key="var" value="TEST"/>
    <!-- <ref bean="batchCycle" /> -->
    <property name="pageSize" value="50" />
    <property name="saveState" value="true" />

    <bean id="testQueryProvider"
    class="org.springframework.batch.item.database.sup port.MySqlPagingQueryProvider">
    <property name="selectClause" value="SELECT id, first_name, last_name, status" />
    <property name="fromClause" value="FROM personal_details" />
    <property name="whereClause" value="WHERE status = 0 AND department = :var" />
    <property name="sortKey" value="last_name" />

    <bean id="batchCycle"
    class="org.springframework.beans.factory.config.Me thodInvokingFactoryBean">
    <property name="targetClass">
    <property name="targetMethod">