List of usage examples for javax.persistence.criteria Expression in
Predicate in(Expression<Collection<?>> values);
From source file:org.niord.core.db.CriteriaHelper.java
/** * If values is defined, matches the attribute with any of the values. * If values is undefined (null or empty) this predicate yields false. * * @param attr the attribute// w ww. j av a 2s.com * @param values the values to match */ public <V> CriteriaHelper<T> in(Expression<V> attr, Collection<V> values) { if (values != null && values.size() > 0) { where.add(attr.in(values)); } else { where.add(cb.disjunction()); // Always false } return this; }