我已经编写了jdbcinboud通道适配器如下。我正在使用更新查询。但它不工作。查询检索两行,但更新语句没有设置这两行的accType
为'P'。请告知
<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>
1条答案
按热度按时间frebpwbc1#
它确实在每个轮询周期调用
query="SELECT * FROM Accounts"
,并提取100
行,在您的情况下,这些可能只是第一个100
,因为没有其他条件要过滤掉。一般来说,执行一个没有任何
WHERE
的公共SELECT
是不好的做法。可以看到,有一个
update
属性要对刚拉出来的行执行,您的SELECT
必须使用WHERE
进行调整,以便只接受那些以前没有更新过的行。更多信息请参见文档:https://docs.spring.io/spring-integration/reference/html/jdbc.html#jdbc-inbound-channel-adapter