I have a spring batch program which reads from one database and writes to a file.
It has item reader as below:
<beans:bean id="myItemReader" class="org.springframework.batch.item.database.JdbcCursorItemReader">
<beans:property name="dataSource" ref="jobRepository-dataSource" />
<beans:property name="sql" value="${dbTofileDataReadSQL}"/>
<beans:property name="rowMapper">
<beans:bean class="com.mypackage.MyRowMapper" />
</beans:property>
</beans:bean>
The sql is something like:
select one, two, three, four from myTable where business_date='12/12/11'
This line will go into my properties file:
dbTofileDataReadSQL = select one, two, three, four from myTable where business_date='12/12/11'
How to pass this business date at run time in the item reader so that it gets added in item reader.
Thanks for reading!!