Class CommonAbstractCriteriaImpl<T>

  • All Implemented Interfaces:
    jakarta.persistence.criteria.CommonAbstractCriteria, Serializable
    Direct Known Subclasses:
    AbstractQueryImpl, CriteriaDeleteImpl, CriteriaUpdateImpl

    public abstract class CommonAbstractCriteriaImpl<T>
    extends Object
    implements jakarta.persistence.criteria.CommonAbstractCriteria, Serializable

    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
    Author:
    Chris Delahunt
    See Also:
    CommonAbstractCriteria, Serialized Form
    • Method Summary

      All Methods Instance Methods Abstract Methods Concrete Methods 
      Modifier and Type Method Description
      void addParameter​(jakarta.persistence.criteria.ParameterExpression<?> parameter)  
      protected void findRootAndParameters​(jakarta.persistence.criteria.Expression<?> predicate)  
      protected void findRootAndParameters​(jakarta.persistence.criteria.Order order)  
      protected abstract Expression getBaseExpression()  
      protected abstract DatabaseQuery getDatabaseQuery()  
      Set<jakarta.persistence.criteria.ParameterExpression<?>> getParameters()
      Return the parameters of the query
      jakarta.persistence.criteria.Predicate getRestriction()
      Return the predicate that corresponds to the where clause restriction(s).
      Class<T> getResultType()
      Return the result type of the query.
      protected abstract void integrateRoot​(RootImpl root)
      Used to use a root from a different query.
      jakarta.persistence.criteria.Root internalFrom​(jakarta.persistence.metamodel.EntityType entity)
      Add a query root corresponding to the given entity, forming a Cartesian product with any existing roots.
      jakarta.persistence.criteria.Root internalFrom​(Class entityClass)
      Add a query root corresponding to the given entity, forming a Cartesian product with any existing roots.
      <U> jakarta.persistence.criteria.Subquery<U> subquery​(Class<U> type)
      Specify that the query is to be used as a subquery having the specified return type.
      DatabaseQuery translate()
      Translates from the criteria query to a EclipseLink Database Query.
      jakarta.persistence.criteria.CommonAbstractCriteria where​(jakarta.persistence.criteria.Expression<Boolean> restriction)
      Modify the query to restrict the query results according to the specified boolean expression.
      jakarta.persistence.criteria.CommonAbstractCriteria where​(jakarta.persistence.criteria.Predicate... restrictions)
      Modify the query to restrict the query results according to the conjunction of the specified restriction predicates.
    • Field Detail

      • metamodel

        protected jakarta.persistence.metamodel.Metamodel metamodel
      • where

        protected jakarta.persistence.criteria.Expression<Boolean> where
      • queryType

        protected Class queryType
      • parameters

        protected Set<jakarta.persistence.criteria.ParameterExpression<?>> parameters
    • Constructor Detail

      • CommonAbstractCriteriaImpl

        public CommonAbstractCriteriaImpl​(jakarta.persistence.metamodel.Metamodel metamodel,
                                          CriteriaBuilderImpl queryBuilder,
                                          Class<T> resultType)
    • Method Detail

      • getRestriction

        public jakarta.persistence.criteria.Predicate getRestriction()
        Return the predicate that corresponds to the where clause restriction(s).
        Specified by:
        getRestriction in interface jakarta.persistence.criteria.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.
        Returns:
        result type
      • internalFrom

        public jakarta.persistence.criteria.Root internalFrom​(jakarta.persistence.metamodel.EntityType 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 jakarta.persistence.criteria.Root internalFrom​(Class 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 jakarta.persistence.criteria.CommonAbstractCriteria where​(jakarta.persistence.criteria.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 jakarta.persistence.criteria.CommonAbstractCriteria where​(jakarta.persistence.criteria.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
      • subquery

        public <U> jakarta.persistence.criteria.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 jakarta.persistence.criteria.CommonAbstractCriteria
        Returns:
        subquery corresponding to the query
      • integrateRoot

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

        protected void findRootAndParameters​(jakarta.persistence.criteria.Expression<?> predicate)
      • findRootAndParameters

        protected void findRootAndParameters​(jakarta.persistence.criteria.Order order)
      • getBaseExpression

        protected abstract Expression getBaseExpression()
      • addParameter

        public void addParameter​(jakarta.persistence.criteria.ParameterExpression<?> parameter)
      • getDatabaseQuery

        protected abstract DatabaseQuery getDatabaseQuery()
      • getParameters

        public Set<jakarta.persistence.criteria.ParameterExpression<?>> getParameters()
        Return the parameters of the query
        Returns:
        the query parameters
      • translate

        public DatabaseQuery translate()
        Translates from the criteria query to a EclipseLink Database Query.