Class CommonAbstractCriteriaImpl<T>

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

    public abstract class CommonAbstractCriteriaImpl<T>
    extends java.lang.Object
    implements javax.persistence.criteria.CommonAbstractCriteria, java.io.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
    • Field Summary

      Fields 
      Modifier and Type Field Description
      protected javax.persistence.metamodel.Metamodel metamodel  
      protected java.util.Set<javax.persistence.criteria.ParameterExpression<?>> parameters  
      protected CriteriaBuilderImpl queryBuilder  
      protected java.lang.Class queryType  
      protected javax.persistence.criteria.Expression<java.lang.Boolean> where  
    • Method Summary

      All Methods Instance Methods Abstract Methods Concrete Methods 
      Modifier and Type Method Description
      void addParameter​(javax.persistence.criteria.ParameterExpression<?> parameter)  
      protected void findRootAndParameters​(javax.persistence.criteria.Expression<?> predicate)  
      protected void findRootAndParameters​(javax.persistence.criteria.Order order)  
      protected abstract org.eclipse.persistence.expressions.Expression getBaseExpression()  
      protected abstract org.eclipse.persistence.queries.DatabaseQuery getDatabaseQuery()  
      java.util.Set<javax.persistence.criteria.ParameterExpression<?>> getParameters()
      Return the parameters of the query
      javax.persistence.criteria.Predicate getRestriction()
      Return the predicate that corresponds to the where clause restriction(s).
      java.lang.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.
      javax.persistence.criteria.Root internalFrom​(java.lang.Class entityClass)
      Add a query root corresponding to the given entity, forming a Cartesian product with any existing roots.
      javax.persistence.criteria.Root internalFrom​(javax.persistence.metamodel.EntityType entity)
      Add a query root corresponding to the given entity, forming a Cartesian product with any existing roots.
      <U> javax.persistence.criteria.Subquery<U> subquery​(java.lang.Class<U> type)
      Specify that the query is to be used as a subquery having the specified return type.
      org.eclipse.persistence.queries.DatabaseQuery translate()
      Translates from the criteria query to a EclipseLink Database Query.
      javax.persistence.criteria.CommonAbstractCriteria where​(javax.persistence.criteria.Expression<java.lang.Boolean> restriction)
      Modify the query to restrict the query results according to the specified boolean expression.
      javax.persistence.criteria.CommonAbstractCriteria where​(javax.persistence.criteria.Predicate... restrictions)
      Modify the query to restrict the query results according to the conjunction of the specified restriction predicates.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • metamodel

        protected javax.persistence.metamodel.Metamodel metamodel
      • where

        protected javax.persistence.criteria.Expression<java.lang.Boolean> where
      • queryType

        protected java.lang.Class queryType
      • parameters

        protected java.util.Set<javax.persistence.criteria.ParameterExpression<?>> parameters
    • Constructor Detail

      • CommonAbstractCriteriaImpl

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

      • getRestriction

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

        public java.lang.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 javax.persistence.criteria.Root internalFrom​(javax.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 javax.persistence.criteria.Root internalFrom​(java.lang.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 javax.persistence.criteria.CommonAbstractCriteria where​(javax.persistence.criteria.Expression<java.lang.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 javax.persistence.criteria.CommonAbstractCriteria where​(javax.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> javax.persistence.criteria.Subquery<U> subquery​(java.lang.Class<U> type)
        Specify that the query is to be used as a subquery having the specified return type.
        Specified by:
        subquery in interface javax.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​(javax.persistence.criteria.Expression<?> predicate)
      • findRootAndParameters

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

        protected abstract org.eclipse.persistence.expressions.Expression getBaseExpression()
      • addParameter

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

        protected abstract org.eclipse.persistence.queries.DatabaseQuery getDatabaseQuery()
      • getParameters

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

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