Is there a possibility to use a parameter list in Criteria API .in expression?
I have something like this:
List<Long> list = new ArrayList<Long>();
list.add((long)1);
list.add((long)2);
list.add((long)3);
CriteriaBuilder cb = em.getCriteriaBuilder();
CriteriaQuery<Bewerbung> criteriaQuery = cb.createQuery(Bewerbung.class);
Root<Bewerbung> bewerbung = criteriaQuery.from(Bewerbung.class);
criteriaQuery.select(bewerbung).where(
cb.in(bewerbung.get(Bewerbung_.bewerberNummer)).value(list);
return em.createQuery(criteriaQuery).getResultList();
The expression .value(list)
does not work as value()
is expecting a paramter of type long not a list.
In my case it is not possible to use a subquery.
Can anyone help me on this issue?