dynamic select query for spring jdbc inbound adapter -
can define dynamic query jdbc inbound channel adapter?
<int-jdbc:inbound-channel-adapter max-rows-per-poll="1" query ="#{'select * work status=0 , and test='' + test.testvalue+ '' order date_modified'}" channel="test" data-source="testds" update="update work set status=1 id in (:id)" > <int:poller fixed-rate="100"> <int:transactional transaction-manager="testtm"/> </int:poller> </int-jdbc:inbound-channel-adapter> here have test bean defined , has method gettestvalue(). not working. suggestions?
try use select-sql-parameter-source attribute of int-jdbc:inbound-channel-adapter
<int-jdbc:inbound-channel-adapter query="select * user lower(username)=:key" channel="inputchannel" data-source="datasource" update="update dummy set dummy_value='test'" row-mapper="personresultmapper" select-sql-parameter-source="parametersource" /> <bean id="parametersource" class="class extend abstractsqlparametersource" /> the class extends abstractsqlparametersource responsible supplying value parameter.
more details can found at: https://gist.github.com/dsyer/472357
Comments
Post a Comment