Interface CriteriaQuery<T>

Type Parameters:
T - Query result type
All Known Implementing Classes:
CriteriaQueryImpl

public interface CriteriaQuery<T>
Interface used to control the execution of typed queries.
  • Method Details

    • from

      <X> Root<X> from(Class<X> entityClass)
      Create and add a query root corresponding to the given entity class.
      Parameters:
      entityClass - the entity class
      Returns:
      query root corresponding to the given entity
    • from

      <X> Root<X> from(EntityType<X> entity)
      Create and add a query root corresponding to the given entity type.
      Parameters:
      entity - metamodel entity representing the entity of type X
      Returns:
      query root corresponding to the given entity
    • select

      CriteriaQuery<T> select(Selection<? extends T> selection)
      Specify the item that is to be returned in the query result. Replaces the previously specified selection(s), if any.
      Parameters:
      selection - - selection specifying the item that is to be returned in the query result
      Returns:
      the modified query
    • where

      CriteriaQuery<T> where(Expression<Boolean> expression)
      Modify the query to restrict the query result according to the specified boolean expression. Replaces the previously added restriction(s), if any.
      Parameters:
      expression - - a simple or compound boolean expression
      Returns:
      the modified query
    • where

      CriteriaQuery<T> where(Predicate... predicates)
      Modify the query to restrict the query result according to the conjunction of the specified restriction predicates. Replaces the previously added restriction(s), if any. If no restrictions are specified, any previously added restrictions are simply removed.
      Parameters:
      predicates - - zero or more restriction predicates
      Returns:
      the modified query
    • where

      CriteriaQuery<T> where(List<Predicate> predicates)
      Modify the query to restrict the query result according to the conjunction of the specified restriction predicates. Replaces the previously added restriction(s), if any. If no restrictions are specified, any previously added restrictions are simply removed.
      Parameters:
      predicates - - list of predicates
      Returns:
      the modified query
    • getResultType

      Class<T> getResultType()
    • distinct

      CriteriaQuery<T> distinct(boolean distinct)
      Specify whether duplicate query results will be eliminated. A true value will cause duplicates to be eliminated. A false value will cause duplicates to be retained. If distinct has not been specified, duplicate results must be retained.
      Parameters:
      distinct - - boolean value specifying whether duplicate results must be eliminated from the query result or whether they must be retained
      Returns:
      the modified query
    • distinct

      CriteriaQuery<T> distinct()
      Specify that duplicates query results will be eliminated.
      Returns:
      the modified query
    • isDistinct

      boolean isDistinct()
      Return whether duplicate query results must be eliminated or retained.
      Returns:
      boolean indicating whether duplicate query results must be eliminated
    • getSelection

      Selection<T> getSelection()
      Return the selection of the query, or null if no selection has been set.
      Returns:
      selection item
    • getRestriction

      Predicate getRestriction()
      Return the predicate that corresponds to the where clause restriction(s), or null if no restrictions have been specified.
      Returns:
      where clause predicate
    • groupBy

      CriteriaQuery<T> groupBy(Expression<?>... grouping)
      Specify the expressions that are used to form groups over the query results. Replaces the previous specified grouping expressions, if any. If no grouping expressions are specified, any previously added grouping expressions are simply removed.
      Parameters:
      grouping - zero or more grouping expressions
      Returns:
      the modified query
    • groupBy

      CriteriaQuery<T> groupBy(List<Expression<?>> grouping)
      Specify the expressions that are used to form groups over the query results. Replaces the previous specified grouping expressions, if any. If no grouping expressions are specified, any previously added grouping expressions are simply removed.
      Parameters:
      grouping - list of zero or more grouping expressions
      Returns:
      the modified query
    • orderBy

      CriteriaQuery<T> orderBy(List<Order> o)
      Specify the ordering expressions that are used to order the query results. Replaces the previous ordering expressions, if any. If no ordering expressions are specified, the previous ordering, if any, is simply removed, and results will be returned in no particular order. The left-to-right sequence of the ordering expressions determines the precedence, whereby the leftmost has highest precedence.
      Parameters:
      o - list of zero or more ordering expressions
      Returns:
      the modified query
    • orderBy

      CriteriaQuery<T> orderBy(Order... o)
      Specify the ordering expressions that are used to order the query results. Replaces the previous ordering expressions, if any. If no ordering expressions are specified, the previous ordering, if any, is simply removed, and results will be returned in no particular order. The left-to-right sequence of the ordering expressions determines the precedence, whereby the leftmost has highest precedence.
      Parameters:
      o - zero or more ordering expressions
      Returns:
      the modified query
    • getOrderList

      List<Order> getOrderList()
      Return the ordering expressions in order of precedence. Returns empty list if no ordering expressions have been specified.
      Returns:
      the list of ordering expressions
    • having

      CriteriaQuery<T> having(Expression<Boolean> restriction)
      Specify a restriction over the groups of the query. Replaces the previous having restriction(s), if any.
      Parameters:
      restriction - a simple or compound boolean expression
      Returns:
      the modified query
    • having

      CriteriaQuery<T> having(Predicate... restrictions)
      Specify restrictions over the groups of the query according the conjunction of the specified restriction predicates. Replaces the previously added having restriction(s), if any. If no restrictions are specified, any previously added restrictions are simply removed.
      Parameters:
      restrictions - zero or more restriction predicates
      Returns:
      the modified query