Add a method to set a "not in" WHERE clause in CriteriaQueryBuilder (#1225)

<!-- Reviewable:start -->
This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/google/nomulus/1225)
<!-- Reviewable:end -->
This commit is contained in:
Lai Jiang
2021-07-07 15:49:29 -04:00
committed by GitHub
parent e5b9ff1498
commit 2195ba90fa
2 changed files with 22 additions and 0 deletions
@@ -62,6 +62,13 @@ public class CriteriaQueryBuilder<T> {
return where(root.get(fieldName).in(values));
}
/**
* Adds a WHERE clause to the query specifying that a value must not be in the given collection.
*/
public CriteriaQueryBuilder<T> whereFieldIsNotIn(String fieldName, Collection<?> values) {
return where(root.get(fieldName).in(values).not());
}
/**
* Adds a WHERE clause to the query specifying that a collection field must contain a particular
* value.