org.datanucleus.jpa.criteria
Class CriteriaQueryImpl<T>

java.lang.Object
  extended by org.datanucleus.jpa.criteria.CriteriaQueryImpl<T>
All Implemented Interfaces:
javax.persistence.criteria.AbstractQuery<T>, javax.persistence.criteria.CriteriaQuery<T>

public class CriteriaQueryImpl<T>
extends java.lang.Object
implements javax.persistence.criteria.CriteriaQuery<T>

Implementation of JPA2 Criteria "Query". When the user calls getCompilation() or getParameters(, or toString() then that part of the query is compiled. Any subsequent update will require the compilation to be redone.


Constructor Summary
CriteriaQueryImpl(MetamodelImpl model, java.lang.Class<T> resultClass)
          Constructor for a criteria query for the supplied model and result class.
 
Method Summary
protected  void discardCompiled()
           
 javax.persistence.criteria.CriteriaQuery<T> distinct(boolean flag)
           
<X> javax.persistence.criteria.Root<X>
from(java.lang.Class<X> cls)
           
<X> javax.persistence.criteria.Root<X>
from(javax.persistence.metamodel.EntityType<X> type)
           
 org.datanucleus.query.compiler.QueryCompilation getCompilation(org.datanucleus.metadata.MetaDataManager mmgr, org.datanucleus.ClassLoaderResolver clr)
          Accessor for the generic compilation that this criteria query equates to.
 java.util.List<javax.persistence.criteria.Expression<?>> getGroupList()
           
 javax.persistence.criteria.Predicate getGroupRestriction()
           
 javax.persistence.metamodel.Metamodel getMetamodel()
          Accessor for the model used by this query.
 java.util.List<javax.persistence.criteria.Order> getOrderList()
           
 java.util.Set<javax.persistence.criteria.ParameterExpression<?>> getParameters()
           
protected  void getParametersForQueryExpression(org.datanucleus.query.expression.Expression expr, java.util.List params)
           
 javax.persistence.criteria.Predicate getRestriction()
           
 java.lang.Class<T> getResultType()
           
 java.util.Set<javax.persistence.criteria.Root<?>> getRoots()
           
 javax.persistence.criteria.Selection<T> getSelection()
           
 javax.persistence.criteria.CriteriaQuery<T> groupBy(javax.persistence.criteria.Expression<?>... exprs)
           
 javax.persistence.criteria.CriteriaQuery<T> groupBy(java.util.List<javax.persistence.criteria.Expression<?>> exprs)
           
 javax.persistence.criteria.CriteriaQuery<T> having(javax.persistence.criteria.Expression<java.lang.Boolean> expr)
           
 javax.persistence.criteria.CriteriaQuery<T> having(javax.persistence.criteria.Predicate... exprs)
           
 boolean isDistinct()
           
 javax.persistence.criteria.CriteriaQuery<T> multiselect(java.util.List<javax.persistence.criteria.Selection<?>> selects)
           
 javax.persistence.criteria.CriteriaQuery<T> multiselect(javax.persistence.criteria.Selection<?>... selects)
           
 javax.persistence.criteria.CriteriaQuery<T> orderBy(java.util.List<javax.persistence.criteria.Order> orders)
           
 javax.persistence.criteria.CriteriaQuery<T> orderBy(javax.persistence.criteria.Order... orders)
           
 javax.persistence.criteria.CriteriaQuery<T> select(javax.persistence.criteria.Selection<? extends T> select)
           
<U> javax.persistence.criteria.Subquery<U>
subquery(java.lang.Class<U> type)
           
 java.lang.String toString()
          Method to return a single-string representation of the criteria query in JPQL.
 javax.persistence.criteria.CriteriaQuery<T> where(javax.persistence.criteria.Expression<java.lang.Boolean> expr)
           
 javax.persistence.criteria.CriteriaQuery<T> where(javax.persistence.criteria.Predicate... exprs)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

CriteriaQueryImpl

public CriteriaQueryImpl(MetamodelImpl model,
                         java.lang.Class<T> resultClass)
Constructor for a criteria query for the supplied model and result class.

Parameters:
model - The model
resultClass - Result class (if any)
Method Detail

getMetamodel

public javax.persistence.metamodel.Metamodel getMetamodel()
Accessor for the model used by this query.

Returns:
The model

distinct

public javax.persistence.criteria.CriteriaQuery<T> distinct(boolean flag)
Specified by:
distinct in interface javax.persistence.criteria.AbstractQuery<T>
Specified by:
distinct in interface javax.persistence.criteria.CriteriaQuery<T>

isDistinct

public boolean isDistinct()
Specified by:
isDistinct in interface javax.persistence.criteria.AbstractQuery<T>

select

public javax.persistence.criteria.CriteriaQuery<T> select(javax.persistence.criteria.Selection<? extends T> select)
Specified by:
select in interface javax.persistence.criteria.CriteriaQuery<T>

multiselect

public javax.persistence.criteria.CriteriaQuery<T> multiselect(java.util.List<javax.persistence.criteria.Selection<?>> selects)
Specified by:
multiselect in interface javax.persistence.criteria.CriteriaQuery<T>

multiselect

public javax.persistence.criteria.CriteriaQuery<T> multiselect(javax.persistence.criteria.Selection<?>... selects)
Specified by:
multiselect in interface javax.persistence.criteria.CriteriaQuery<T>

getSelection

public javax.persistence.criteria.Selection<T> getSelection()
Specified by:
getSelection in interface javax.persistence.criteria.AbstractQuery<T>

getResultType

public java.lang.Class<T> getResultType()
Specified by:
getResultType in interface javax.persistence.criteria.AbstractQuery<T>

from

public <X> javax.persistence.criteria.Root<X> from(java.lang.Class<X> cls)
Specified by:
from in interface javax.persistence.criteria.AbstractQuery<T>

from

public <X> javax.persistence.criteria.Root<X> from(javax.persistence.metamodel.EntityType<X> type)
Specified by:
from in interface javax.persistence.criteria.AbstractQuery<T>

getRoots

public java.util.Set<javax.persistence.criteria.Root<?>> getRoots()
Specified by:
getRoots in interface javax.persistence.criteria.AbstractQuery<T>

where

public javax.persistence.criteria.CriteriaQuery<T> where(javax.persistence.criteria.Expression<java.lang.Boolean> expr)
Specified by:
where in interface javax.persistence.criteria.AbstractQuery<T>
Specified by:
where in interface javax.persistence.criteria.CriteriaQuery<T>

where

public javax.persistence.criteria.CriteriaQuery<T> where(javax.persistence.criteria.Predicate... exprs)
Specified by:
where in interface javax.persistence.criteria.AbstractQuery<T>
Specified by:
where in interface javax.persistence.criteria.CriteriaQuery<T>

getRestriction

public javax.persistence.criteria.Predicate getRestriction()
Specified by:
getRestriction in interface javax.persistence.criteria.AbstractQuery<T>

groupBy

public javax.persistence.criteria.CriteriaQuery<T> groupBy(javax.persistence.criteria.Expression<?>... exprs)
Specified by:
groupBy in interface javax.persistence.criteria.AbstractQuery<T>
Specified by:
groupBy in interface javax.persistence.criteria.CriteriaQuery<T>

groupBy

public javax.persistence.criteria.CriteriaQuery<T> groupBy(java.util.List<javax.persistence.criteria.Expression<?>> exprs)
Specified by:
groupBy in interface javax.persistence.criteria.AbstractQuery<T>
Specified by:
groupBy in interface javax.persistence.criteria.CriteriaQuery<T>

getGroupList

public java.util.List<javax.persistence.criteria.Expression<?>> getGroupList()
Specified by:
getGroupList in interface javax.persistence.criteria.AbstractQuery<T>

getGroupRestriction

public javax.persistence.criteria.Predicate getGroupRestriction()
Specified by:
getGroupRestriction in interface javax.persistence.criteria.AbstractQuery<T>

having

public javax.persistence.criteria.CriteriaQuery<T> having(javax.persistence.criteria.Expression<java.lang.Boolean> expr)
Specified by:
having in interface javax.persistence.criteria.AbstractQuery<T>
Specified by:
having in interface javax.persistence.criteria.CriteriaQuery<T>

having

public javax.persistence.criteria.CriteriaQuery<T> having(javax.persistence.criteria.Predicate... exprs)
Specified by:
having in interface javax.persistence.criteria.AbstractQuery<T>
Specified by:
having in interface javax.persistence.criteria.CriteriaQuery<T>

getOrderList

public java.util.List<javax.persistence.criteria.Order> getOrderList()
Specified by:
getOrderList in interface javax.persistence.criteria.CriteriaQuery<T>

orderBy

public javax.persistence.criteria.CriteriaQuery<T> orderBy(java.util.List<javax.persistence.criteria.Order> orders)
Specified by:
orderBy in interface javax.persistence.criteria.CriteriaQuery<T>

orderBy

public javax.persistence.criteria.CriteriaQuery<T> orderBy(javax.persistence.criteria.Order... orders)
Specified by:
orderBy in interface javax.persistence.criteria.CriteriaQuery<T>

subquery

public <U> javax.persistence.criteria.Subquery<U> subquery(java.lang.Class<U> type)
Specified by:
subquery in interface javax.persistence.criteria.AbstractQuery<T>

discardCompiled

protected void discardCompiled()

getParameters

public java.util.Set<javax.persistence.criteria.ParameterExpression<?>> getParameters()
Specified by:
getParameters in interface javax.persistence.criteria.CriteriaQuery<T>

getCompilation

public org.datanucleus.query.compiler.QueryCompilation getCompilation(org.datanucleus.metadata.MetaDataManager mmgr,
                                                                      org.datanucleus.ClassLoaderResolver clr)
Accessor for the generic compilation that this criteria query equates to.

Returns:
The generic compilation

toString

public java.lang.String toString()
Method to return a single-string representation of the criteria query in JPQL.

Overrides:
toString in class java.lang.Object
Returns:
The single-string form

getParametersForQueryExpression

protected void getParametersForQueryExpression(org.datanucleus.query.expression.Expression expr,
                                               java.util.List params)


Copyright © 2011. All Rights Reserved.