Java Code Examples for javax.persistence.criteria.CriteriaBuilder.In

The following are Jave code examples for showing how to use In of the javax.persistence.criteria.CriteriaBuilder class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
Example 1
Project: sucok-framework   File: NotIn.java   Source Code and License Vote up 7 votes
@Override
public Predicate buildJpaPredicate(CriteriaBuilder builder, Root<?> root) {
	Expression<Object> path = QueryFormHelper.getPath(root, field);
	CriteriaBuilder.In<Object> predicate = builder.in(path);
	int length = Array.getLength(value);
	for (int i = 0; i < length; i++) {
		predicate.value(Array.get(value, i));
	}
	return builder.not(predicate);
}
 
Example 2
Project: sucok-framework   File: In.java   Source Code and License Vote up 6 votes
@Override
public Predicate buildJpaPredicate(CriteriaBuilder builder, Root<?> root) {
	Expression<Object> path = QueryFormHelper.getPath(root, field);
	CriteriaBuilder.In<Object> predicate = builder.in(path);
	int length = Array.getLength(value);
	for (int i = 0; i < length; i++) {
		predicate.value(Array.get(value, i));
	}
	return predicate;
}