mardi 3 mars 2015

Use a query that takes parameters in Spring Batch

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


Aucun commentaire:

Enregistrer un commentaire