Reputation: 633
I'm trying to implement database access with Helidon 4 SE, DbClient and PostgresSQL. Is there any way to pass collection of params to query? I tried this code:
@Override
public List<Foo> getFooList(Set<Long> barIds) {
var query = "SELECT * FROM foo WHERE bar_id IN (?)";
return dbClient.execute()
.createQuery(query)
.addParam(barIds)
.execute()
.stream()
.map(
//parse result
)
.toList();
}
But unfortunately it returns the following error:
Can't infer the SQL type to use for an instance of java.util.HashSet. Use setObject() with an explicit Types value to specify the type to use.
I can't see any methods in query builder that accept collection of params.
Or maybe Helidon DbClient is not suitable for this and I should use another lib?
Upvotes: 1
Views: 101
Reputation: 16238
(I am not an expert in this area of the code.) From a few seconds of looking at Helidon's copious documentation it would seem that the various documented params
methods might suit your purposes.
Upvotes: 0