1
我有以下bean定義:JdbcPollingChannelAdapter更新 - 無豆
@Bean
JdbcPollingChannelAdapter jdbcPollingChannelAdapter() {
// Get all the pending jobs
JdbcPollingChannelAdapter adapter = new JdbcPollingChannelAdapter(jdbcTemplate, "select id from poller_jobs where status = 'PENDING'");
// Immediately mark them as running so the next jdbc poll doesn't re-process them
adapter.setUpdateSql("update poller_jobs set status='RUNNING' where id in (:id)");
adapter.setMaxRowsPerPoll(100);
adapter.setRowMapper((r, i) -> r.getLong("id"));
return adapter;
}
而這種失敗,因爲該行映射器映射到只是一個long
ID,因此適配器不知道如何獲取更新中需要的ID。任何人都知道如何做到這一點,而不需要select *
並映射到一個完整的對象?這似乎比我真正需要的更多的開銷。
完美地工作。謝謝! –