Interface PredicateBuilder.SubqueryFactory

Enclosing interface:
PredicateBuilder

public static interface PredicateBuilder.SubqueryFactory
This interface allows to create subqueries in predicates without exposing the CriteriaQuery instance.
  • Method Details

    • deriveFor

      PredicateBuilder.SubqueryFactory deriveFor(jakarta.persistence.criteria.From<?,?> root)
    • createSubquery

      <T> SubqueryBuilder<T> createSubquery(Class<T> resultType, jakarta.persistence.criteria.From<?,?> root, String relationName)
    • createUncorrelatedSubquery

      <T> SubqueryBuilder<T> createUncorrelatedSubquery(Class<T> resultType, Class<?> targetType)
    • createSubquery

      <T> SubqueryBuilder<T> createSubquery(Class<T> type, String relationName, String column)
      Create a correlated sub query that selects a column from the related entity model, applying the given relation path to the current query root.
      Type Parameters:
      T - the return type of the Query, equal to the type of the column
      Parameters:
      type - the type of the selected column
      relationName - the name to resolve to the target entity model
      column - the single column to select
      Returns:
      the created SubqueryBuilder
    • createUncorrelatedSubquery

      <T> SubqueryBuilder<T> createUncorrelatedSubquery(Class<T> type, String entityModel, String column)
      Create an uncorrelated sub query that selects any column from any given entity model without a relation.
      Type Parameters:
      T - the return type of the Query, equal to the type of the column
      Parameters:
      type - the type of the selected column
      entityModel - the target entity model name
      column - the column to select
      Returns:
      the created SubqueryBuilder
    • createSubquery

      <T> SubqueryBuilder<T> createSubquery(Class<T> type, String relationName, BiFunction<jakarta.persistence.criteria.CriteriaBuilder,jakarta.persistence.criteria.From<?,?>,jakarta.persistence.criteria.Expression<T>> selectionFunc)
      Create a correlated sub query that selects the expression returned by the given selectionFunc from the related entity model, applying the given relation path to the current query root.
      Type Parameters:
      T - the return type of the Query, equal to the type of the column
      Parameters:
      type - the type of the selected column
      relationName - the name to resolve to the target entity model
      selectionFunc - function returning the expression to select
      Returns:
      the created SubqueryBuilder
    • createUncorrelatedSubquery

      <T> SubqueryBuilder<T> createUncorrelatedSubquery(Class<T> type, String entityModel, BiFunction<jakarta.persistence.criteria.CriteriaBuilder,jakarta.persistence.criteria.From<?,?>,jakarta.persistence.criteria.Expression<T>> selectionFunc)
      Create an uncorrelated sub query that selects the expression returned by the given selectionFunc from any given entity model without a relation.
      Type Parameters:
      T - return type of query, equal to type of selected expression
      Parameters:
      type - type of value returned by the selectionFunc
      entityModel - the target entity model name
      selectionFunc - function returning the expression to select
      Returns:
      the created SubqueryBuilder