I'm using SpringBoot 2.2.6
with JPA
and I need to do query with IN
clause as mentioned in Title. I have try with:
@Override
public Predicate toPredicate(Root<Distinta> root, CriteriaQuery<?> query, CriteriaBuilder builder) {
List<Predicate> predicates = new ArrayList<>();
.....
.....
for (DistintaCriteria criteria : list) {
switch(criteria.getOperation()) {
case TEST:
Join<Entity, JoinEntity> join = root.join("joinEntity");
predicates.add(join.<Integer>get("id").in(criteria.getValue()));
}
}
where criteria.getValue()
is a Integer[]
array but it doesn't work. Can you help me?
Thank you all.
UPDATE
If I try the same Query
with List<String>
it works! With Integer I had this error:
Unaware how to convert value [[2, 3, 4, 5] : java.util.ArrayList] to requested type [java.lang.Integer]