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

  • Using parameterized sql with Itemreader

    Hi,
    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>
    <property name="parameterValues">
    <map>
    <entry key="var" value="TEST"/>
    <!-- <ref bean="batchCycle" /> -->
    </map>
    </property>
    <property name="pageSize" value="50" />
    <property name="saveState" value="true" />
    </bean>

    <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>

    <bean id="batchCycle"
    class="org.springframework.beans.factory.config.Me thodInvokingFactoryBean">
    <property name="targetClass">
    <value>gov.irs.cade2.web.BatchCycle</value>
    </property>
    <property name="targetMethod">
    <value>getBatchCycleDate</value>
    </property>
    </bean>
    ------------------------------------------------------------


    Thanks,
    Adarsh
Working...
X