Class CommonAbstractCriteriaImpl<T>

java.lang.Object
org.eclipse.persistence.internal.jpa.querydef.CommonAbstractCriteriaImpl<T>
All Implemented Interfaces:
CommonAbstractCriteria, CriteriaSelect<T>, Serializable, CriteriaSelectInternal<T>
Direct Known Subclasses:
AbstractQueryImpl, CriteriaDeleteImpl, CriteriaUpdateImpl

public abstract class CommonAbstractCriteriaImpl<T> extends Object implements CommonAbstractCriteria, Serializable, CriteriaSelectInternal<T>

Purpose: Contains the implementation of the CommonAbstractCriteria interface of the JPA criteria API.

Description: This is the container class for the components that define a query. This is the superclass of CriteriaQuery, SubQuery, CriteriaDelete and CriteriaUpdate.

Since:
EclipseLink 2.5
See Also:
  • Field Details

  • Constructor Details

  • Method Details

    • getRestriction

      public Predicate getRestriction()
      Return the predicate that corresponds to the where clause restriction(s).
      Specified by:
      getRestriction in interface CommonAbstractCriteria
      Returns:
      where clause predicate
    • getResultType

      public Class<T> getResultType()
      Return the result type of the query. If a result type was specified as an argument to the createQuery method, that type will be returned. If the query was created using the createTupleQuery method, the result type is Tuple. Otherwise, the result type is Object.
      Specified by:
      getResultType in interface CriteriaSelectInternal<T>
      Returns:
      result type
    • internalFrom

      public <R> Root<R> internalFrom(EntityType<R> entity)
      Add a query root corresponding to the given entity, forming a Cartesian product with any existing roots.
      Parameters:
      entity - metamodel entity representing the entity of type X
      Returns:
      query root corresponding to the given entity
    • internalFrom

      public <R> Root<R> internalFrom(Class<R> entityClass)
      Add a query root corresponding to the given entity, forming a Cartesian product with any existing roots.
      Parameters:
      entityClass - the entity class
      Returns:
      query root corresponding to the given entity
    • where

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

      public CommonAbstractCriteria where(Predicate... restrictions)
      Modify the query to restrict the query results 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:
      restrictions - zero or more restriction predicates
      Returns:
      the modified query
    • where

      public CommonAbstractCriteria where(List<Predicate> restrictions)
      Modify the query to restrict the query results 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:
      restrictions - zero or more restriction predicates
      Returns:
      the modified query
      Since:
      5.0
    • subquery

      public <U> Subquery<U> subquery(Class<U> type)
      Specify that the query is to be used as a subquery having the specified return type.
      Specified by:
      subquery in interface CommonAbstractCriteria
      Returns:
      subquery corresponding to the query
    • subquery

      public <U> Subquery<U> subquery(EntityType<U> type)
      Specified by:
      subquery in interface CommonAbstractCriteria
    • integrateRoot

      protected abstract void integrateRoot(RootImpl<?> root)
      Used to use a root from a different query.
    • findRootAndParameters

      protected void findRootAndParameters(Expression<?> predicate)
    • findRootAndParameters

      protected void findRootAndParameters(Order order)
    • getBaseExpression

      protected abstract Expression getBaseExpression()
    • addParameter

      public void addParameter(ParameterExpression<?> parameter)
    • getDatabaseQuery

      protected abstract DatabaseQuery getDatabaseQuery()
    • getParameters

      public Set<ParameterExpression<?>> getParameters()
      Return the parameters of the query
      Specified by:
      getParameters in interface CommonAbstractCriteria
      Returns:
      the query parameters
    • translate

      public DatabaseQuery translate()
      Translates from the criteria query to a EclipseLink Database Query.
      Specified by:
      translate in interface CriteriaSelectInternal<T>
      Returns:
      EclipseLink DatabaseQuery
    • translate

      protected DatabaseQuery translate(DatabaseQuery query)
      Translates from the criteria query to a EclipseLink Database Query. Target DatabaseQuery instance is supplied.
      Parameters:
      query - target DatabaseQuery instance
      Returns:
      EclipseLink DatabaseQuery