Class QueryByExamplePredicateBuilder

java.lang.Object
org.springframework.data.jpa.convert.QueryByExamplePredicateBuilder

public class QueryByExamplePredicateBuilder extends Object
QueryByExamplePredicateBuilder creates a single CriteriaBuilder.and(Predicate...) combined Predicate for a given Example.
The builder includes any SingularAttribute of the Example.getProbe() applying String and null matching strategies configured on the Example. Ignored paths are no matter of their actual value not considered.
Since:
1.10
Author:
Christoph Strobl, Mark Paluch, Oliver Gierke, Jens Schauder, Greg Turnquist
  • Constructor Details

    • QueryByExamplePredicateBuilder

      public QueryByExamplePredicateBuilder()
  • Method Details

    • getPredicate

      @Nullable public static <T> jakarta.persistence.criteria.Predicate getPredicate(jakarta.persistence.criteria.Root<T> root, jakarta.persistence.criteria.CriteriaBuilder cb, Example<T> example)
      Extract the Predicate representing the Example.
      Parameters:
      root - must not be null.
      cb - must not be null.
      example - must not be null.
      Returns:
      null indicates no Predicate.
    • getPredicate

      @Nullable public static <T> jakarta.persistence.criteria.Predicate getPredicate(jakarta.persistence.criteria.Root<T> root, jakarta.persistence.criteria.CriteriaBuilder cb, Example<T> example, EscapeCharacter escapeCharacter)
      Extract the Predicate representing the Example.
      Parameters:
      root - must not be null.
      cb - must not be null.
      example - must not be null.
      escapeCharacter - Must not be null.
      Returns:
      null indicates no constraints