Announcement Announcement Module
Collapse
No announcement yet.
How do I use StepExecutionPreparedStatementSetter Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • How do I use StepExecutionPreparedStatementSetter

    I have seen several recommandations for using the StepExecutionPreparedStatementSetter then I want to use input from the jobParameters into the sql query when using the JdbcCursorItemReader.

    How do I implement this?
    I have registered the bean aggregatedPreparementSetter
    The StepExecutionPreparedStatementSetter has a setValues property taking a PreparedStatement as a parameter. How could I pass my sql:
    select distinct sequenceNumber from AGGREGATED_ACCOUNTING where runDate=to_date('?', 'YYYY-MM-DD') order by sequenceNumber asc

    as a prepared statement into setValues property? May I configure this with spring bean definions, in case which PreparedStatement implementation could I use?

    Code:
        <bean id="aggregatedPreparementSetter" class="org.springframework.batch.core.resource.StepExecutionPreparedStatementSetter">
            <property name="parameterKeys">
                <list>
                    <value>rundate</value>
                </list>
            </property>
        </bean>

  • #2
    Mission completed...

    I figured it out, - by just injecting the aggregatedPreparementSetter into the JdbcCursorItemReader.....

    Comment

    Working...
    X