Actually to substituteNamedParameters
for IN
clause the parameter has to be Collection
not array
. The source code of NamedParameterJdbcTemplate.substituteNamedParameters
:
if (value instanceof Collection) {
Iterator<?> entryIter = ((Collection<?>) value).iterator();
int k = 0;
while (entryIter.hasNext()) {
if (k > 0) {
actualSql.append(", ");
}
......
actualSql.append("?");
So, just construct List
from your strings, not array
:
Arrays.asList("foo", "bar", "baz");
And your real query will be:
select XMLMSG from Table where SEQ_ID in (?, ?, ?)
Other work the JdbcTemplate
will do for you.
UPDATE
Note, by default <int-jdbc:outbound-gateway/>
selects only one record. To get rid this limit specify max-rows-per-poll="0"
.