I have been trying for a while to convert a list of longs into a expression of longs, the purpose of the exercise is to use it in the Criteria Builder "IN" clause so it really has to be an Expression
List<Long> numbers = new ArrayList<>();
numbers.add(1L);
numbers.add(2L);
javax.persistence.criteria.Expression<Long> expressionOfNumbers = (Expression<Long>) numbers;
//query code...
query.where(cb.in(expressionOfNumbers));
All help is appreciated. Thank You.