I have a functioning program that reads from a DB and inputs it into a flat file. I'm using Spring batch for these I want be able to choose the parameters for my query. How can I do that.
My xml look something like this:
<bean id="databaseitemreader" class="JdbcursorItemReader">
<property name = "datasource" <ref = ...>
<property name = sql value= "Select fname , lname , address from tbl_student"/>
Item file writer stuff .....
(This one does not need any change)
I want to be be able to pass dynamic parameters to my query that is stored in the xml file. example: where id = 1234 and current = 'Y' without being hard coded
To map the values I am currently using the rowMapper interface
This section in the Spring Batch Document http://docs.spring.io/spring-batch/reference/html/configureStep.html#late-binding explains how parameter can be passed to the spring batch job.
As to how you extract those parameters from the XML - that would something you would do outside the job - depending on how you are starting up the Job.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With