This week's book giveaway is in the Agile and Other Processes forum.
We're giving away four copies of The Journey To Enterprise Agility and have Daryl Kulak & Hong Li on-line!
See this thread for details.
Win a copy of The Journey To Enterprise Agility this week in the Agile and Other Processes forum! And see the welcome thread for 20% off.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
  • Jeanne Boyarsky
  • Liutauras Vilda
  • Campbell Ritchie
  • Tim Cooke
  • Bear Bibeault
  • Paul Clapham
  • Junilu Lacar
  • Knute Snortum
Saloon Keepers:
  • Ron McLeod
  • Ganesh Patekar
  • Tim Moores
  • Pete Letkeman
  • Stephan van Hulst
  • Carey Brown
  • Tim Holloway
  • Joe Ess

Spring Batch: Passing runtime parameters to query in ItemReader using Qeury XML file  RSS feed

Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all ,

I have used late binding in passing query at run time and it is running fine using properties file .Below is implementaion I have used

<bean id="placeholderProperties" class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
<property name="location" value="path to your properties file, either classpath: ... or c:/... " />

In properties file :

ID, \
Or starting from Spring 3, you can use SpEL:
<util:properties id="myProperties" location="..." />
<beans:bean ...
<beans:property name="sql" value="${sql}"/>

Now my actual requirement is to do same operation using XML file.I have prepared xml file as below


<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE queries
<!ELEMENT queries (nativeQuery)>
<!ELEMENT nativeQuery (queryName,query)>
<!ELEMENT queryName (#PCDATA)>
<!ELEMENT query (#PCDATA)>
<query>select TRN_SERIAL from transactions</query>

In batch job I have configured using this line

<import resource="Queries.xml" />
but I'm unable to bind query in required place
<bean name="payoutReader" id="payoutReader" class="org.springframework.batch.item.database.JdbcCursorItemReader">
<property name="dataSource" ref="dinero-dataSource" />
<property name="sql" value="transactionQuery" />
<property name="rowMapper">
<bean name="mapper" id="mapper" class="com......." />

please guide me in resolving this

  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!