Results 1 to 2 of 2

Thread: How do I use StepExecutionPreparedStatementSetter

  1. #1

    Default 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. #2

    Default Mission completed...

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

Posting Permissions

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