Java Code Examples for javax.persistence.criteria.CriteriaBuilder.not()

The following are Jave code examples for showing how to use not() 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: amanda   File: Criterion.java   Source Code and License Vote up 5 votes
@Override
public Predicate toPredicate(Criterion c, Root<?> r, CriteriaBuilder b) {
    Object o = c.getCompareTo();
    if(o == null)
        return b.not(r.get(c.getPropertyName()).in());
    if(o instanceof Collection)
        return b.not(r.get(c.getPropertyName()).in((Collection)o));
    throw new IllegalArgumentException(c.getPropertyName());
}
 
Example 3
Project: datatable-java   File: Specifications.java   Source Code and License Vote up 4 votes
public Predicate toPredicate(Root<T> root, CriteriaQuery<?> query, CriteriaBuilder builder) {
	return spec == null ? null : builder.not(spec.toPredicate(root, query, builder));
}