Announcement Announcement Module
Collapse
No announcement yet.
Jobparameters to PreparedStatementSetter Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • 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
    Resolved this.

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

    Comment

    Working...
    X