I have written jdbcinboud channel adapter as below. I am using update query. however it is not working. The query retrieves two rows, but update statement does not set the accType
of these two rows to 'P'.
Please advise
<int-jdbc:inbound-channel-adapter id="jdbcInbound"
channel="channel"
data-source="dataSource"
query="SELECT id, acct_nam FROM Accounts where accType ='N'"
update="update Accounts set accType='P' where ID in (:id)
row-mapper="AccountRowMapper"
max-rows-per-poll="100">
<int:poller fixed-rate="1000"/>
</int-jdbc:inbound-channel-adapter>
It does call that query="SELECT * FROM Accounts"
on every polling cycle and pulls 100
rows and probably in your case those are only first 100
since there is no other criteria to filter out.
In general it is bad practice to do a common SELECT
without any WHERE
.
See there is an update
atribute to perform against just pulled rows. Your SELECT
must be adjusted with a WHERE
to take only those rows which have not been updated before.
See more info in docs: https://docs.spring.io/spring-integration/reference/html/jdbc.html#jdbc-inbound-channel-adapter