I can't add the List<...> parameter, or rather ArrayList ($2).
If I just put List<...> listId, I get the error: Cannot encode parameter of type java.util.ArrayList ([192, 193, 194, ....
If I set listId.toArray(), then there is no error, but the query is not executed, and nothing is even written in the logs.
The request is simple, there is no error in it: "update "schema"."table" SET "column" = $1 where "id" in ( $2 )"
The question is relevant for both postgres and mssql, my drivers and query forms in runtime are changing.
Please help me solve the problem...
public <S, T> Mono<Boolean> update(ConnectionFactory connectionFactory, String query, S param, List<T> listId) {
return Mono.usingWhen(connectionFactory.create(),
connection -> {
Statement statement = connection.createStatement(query);
statement.bind("$1", param);
statement.bind("$2", listId);
return Mono.from(statement.execute());
},
Connection::close)
.map(el -> true)
.doOnSuccess((a) -> log.info("Update Success!"))
.onErrorResume(e -> {
log.error("ERROR update : \n{}", e.getMessage());
return Mono.just(false);
});
}