Results 1 to 2 of 2

Thread: Jobparameters to PreparedStatementSetter

Hybrid View

  1. #1

    Default Jobparameters to PreparedStatementSetter

    Hi,

    I have typical batch situation, where I use JdbcCursorItemReader with prepared statement for reading database. PreparedStatement parameter values should be set from JobParameters dynamically.

    My configuration is typical as below:

    Code:
    <bean id="itemReader" class="org.spr...JdbcCursorItemReader">
        <property name="dataSource" ref="dataSource"/>
        <property name="sql" value="select ID, NAME, CREDIT from CUSTOMER where column=?"/>
        <property name="preparedStatementSetter" ref="mySetter"/>
        <property name="rowMapper">
            <bean class="org.springframework.batch.sample.domain.CustomerCreditRowMapper"/>
        </property>
    
    </bean>
    How can I attach stepContext or some other context (where jobParameters are) to my PreparedStatementSetter implementation? I need to get those jobParameter values to my SQL..

  2. #2

    Default

    Resolved this.

    I used dynamic SQL generation with late binding. Idea got from here: http://forum.springsource.org/showthread.php?t=73562

Posting Permissions

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