|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.apache.openjpa.persistence.criteria.CriteriaQueryImpl<T>
class CriteriaQueryImpl<T>
Criteria query implementation. Collects clauses of criteria query (e.g. select projections, from/join, where conditions, order by). Eventually translates these clauses to a similar form of Expression tree that can be interpreted and executed against a data store by OpenJPA kernel.
| Constructor Summary | |
|---|---|
CriteriaQueryImpl(MetamodelImpl model,
Class<T> resultClass)
|
|
CriteriaQueryImpl(MetamodelImpl model,
SubqueryImpl<T> delegator)
Used by a subquery to delegate to this receiver. |
|
| Method Summary | ||
|---|---|---|
(package private) void |
addRoot(RootImpl<?> root)
|
|
void |
assertRoot()
|
|
void |
assertSelection()
|
|
OpenJPACriteriaQuery<T> |
compile()
Compiles to verify that at least one root is defined, a selection term is present and, most importantly, collects all the parameters so that they can be bound to the executable query. |
|
(package private) Context |
ctx()
Gets the current context. |
|
CriteriaQuery<T> |
distinct(boolean distinct)
Sets whether this query as distinct. |
|
boolean |
equals(Object other)
|
|
|
from(Class<X> cls)
|
|
|
from(EntityType<X> entity)
|
|
String |
getAlias(Selection<?> selection)
Gets the alias of the given node. |
|
Map<Selection<?>,String> |
getAliases()
|
|
(package private) CriteriaQueryImpl<?> |
getAncestor()
Gets either this query itself if this is not a captive query for a subquery. |
|
(package private) Stack<Context> |
getContexts()
Gets the stack of contexts used by this query. |
|
(package private) SubqueryImpl<?> |
getDelegator()
Gets the subquery, if any, which is delegating to this receiver. |
|
(package private) CriteriaQueryImpl<?> |
getDelegatorParent()
|
|
List<Expression<?>> |
getGroupList()
|
|
PredicateImpl |
getGroupRestriction()
|
|
MetamodelImpl |
getMetamodel()
Gets the metamodel which defines the scope of all persistent entity references. |
|
List<Order> |
getOrderList()
Gets the list of ordering elements. |
|
Set<ParameterExpression<?>> |
getParameters()
|
|
OrderedMap<Object,Class<?>> |
getParameterTypes()
Return map where key is the parameter expression itself and value is the expected type. |
|
(package private) QueryExpressions |
getQueryExpressions(ExpressionFactory factory)
Populate a kernel expression tree by translating the components of this receiver with the help of the given ExpressionFactory. |
|
Value |
getRegisteredRootVariable(Root<?> root)
Gets the registered variable for the given root. |
|
Value |
getRegisteredValue(Selection<?> selection)
Gets the registered path value for the given node. |
|
Value |
getRegisteredVariable(Selection<?> selection)
Gets the registered variable for the given node. |
|
PredicateImpl |
getRestriction()
|
|
Class<T> |
getResultType()
|
|
Root<?> |
getRoot()
|
|
(package private) Root<?> |
getRoot(boolean mustExist)
|
|
Set<Root<?>> |
getRoots()
|
|
Selection<T> |
getSelection()
Return the selection of the query |
|
List<Selection<?>> |
getSelectionList()
Return the selection items of the query as a list |
|
CriteriaQuery<T> |
groupBy(Expression<?>... grouping)
|
|
CriteriaQuery<T> |
groupBy(List<Expression<?>> grouping)
|
|
CriteriaQuery<T> |
having(Expression<Boolean> restriction)
|
|
CriteriaQuery<T> |
having(Predicate... restrictions)
|
|
(package private) void |
invalidateCompilation()
|
|
protected boolean |
isDefaultProjection()
|
|
boolean |
isDistinct()
Affirms if selection of this query is distinct. |
|
(package private) boolean |
isMultiselect()
|
|
boolean |
isRegistered(Selection<?> selection)
Affirms if the given node has been registered. |
|
CriteriaQuery<T> |
multiselect(List<Selection<?>> list)
|
|
CriteriaQuery<T> |
multiselect(Selection<?>... selections)
Specify the items that are to be returned in the query result. |
|
CriteriaQuery<T> |
orderBy(List<Order> orders)
|
|
CriteriaQuery<T> |
orderBy(Order... orders)
|
|
(package private) void |
registerParameter(ParameterExpressionImpl<?> p)
Registers the given parameter. |
|
(package private) void |
registerRoot(Root<?> root,
Value var)
Registers a variable for the given root expression. |
|
void |
registerVariable(Selection<?> node,
Value var,
Value path)
Register the given variable of given path value against the given node. |
|
(package private) void |
render(StringBuilder buffer,
Set<Root<?>> roots,
List<Join<?,?>> correlatedJoins)
|
|
CriteriaQuery<T> |
select(Selection<? extends T> selection)
Specify the item that is to be returned in the query result. |
|
(package private) void |
setContexts(Stack<Context> contexts)
|
|
|
subquery(Class<U> type)
|
|
String |
toCQL()
Gets the string representation of the query. |
|
String |
toString()
Returns a JPQL-like string, if this receiver is populated. |
|
CriteriaQuery<T> |
where(Expression<Boolean> restriction)
|
|
CriteriaQuery<T> |
where(Predicate... restrictions)
|
|
| Methods inherited from class java.lang.Object |
|---|
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
public CriteriaQueryImpl(MetamodelImpl model,
Class<T> resultClass)
CriteriaQueryImpl(MetamodelImpl model,
SubqueryImpl<T> delegator)
model - the metamodel defines the scope of all persistent entity references.delegator - the subquery which will delegate to this receiver.| Method Detail |
|---|
SubqueryImpl<?> getDelegator()
public MetamodelImpl getMetamodel()
Stack<Context> getContexts()
public CriteriaQuery<T> distinct(boolean distinct)
distinct in interface AbstractQuery<T>distinct in interface CriteriaQuery<T>public List<Order> getOrderList()
getOrderList in interface CriteriaQuery<T>public Selection<T> getSelection()
getSelection in interface AbstractQuery<T>public CriteriaQuery<T> multiselect(Selection<?>... selections)
void registerParameter(ParameterExpressionImpl<?> p)
public Set<ParameterExpression<?>> getParameters()
getParameters in interface CriteriaQuery<T>public List<Selection<?>> getSelectionList()
public CriteriaQuery<T> groupBy(Expression<?>... grouping)
groupBy in interface AbstractQuery<T>groupBy in interface CriteriaQuery<T>public CriteriaQuery<T> groupBy(List<Expression<?>> grouping)
groupBy in interface AbstractQuery<T>groupBy in interface CriteriaQuery<T>public CriteriaQuery<T> having(Expression<Boolean> restriction)
having in interface AbstractQuery<T>having in interface CriteriaQuery<T>public CriteriaQuery<T> having(Predicate... restrictions)
having in interface AbstractQuery<T>having in interface CriteriaQuery<T>public CriteriaQuery<T> orderBy(Order... orders)
orderBy in interface CriteriaQuery<T>public CriteriaQuery<T> orderBy(List<Order> orders)
orderBy in interface CriteriaQuery<T>public CriteriaQuery<T> select(Selection<? extends T> selection)
select in interface CriteriaQuery<T>selection - selection specifying the item that
is to be returned in the query result
public CriteriaQuery<T> where(Expression<Boolean> restriction)
where in interface AbstractQuery<T>where in interface CriteriaQuery<T>public CriteriaQuery<T> where(Predicate... restrictions)
where in interface AbstractQuery<T>where in interface CriteriaQuery<T>public <X> Root<X> from(EntityType<X> entity)
from in interface AbstractQuery<T>public <X> Root<X> from(Class<X> cls)
from in interface AbstractQuery<T>public List<Expression<?>> getGroupList()
getGroupList in interface AbstractQuery<T>public PredicateImpl getGroupRestriction()
getGroupRestriction in interface AbstractQuery<T>public PredicateImpl getRestriction()
getRestriction in interface AbstractQuery<T>public Set<Root<?>> getRoots()
getRoots in interface AbstractQuery<T>public Root<?> getRoot()
Root<?> getRoot(boolean mustExist)
void addRoot(RootImpl<?> root)
public boolean isDistinct()
isDistinct in interface AbstractQuery<T>public <U> Subquery<U> subquery(Class<U> type)
subquery in interface AbstractQuery<T>public OrderedMap<Object,Class<?>> getParameterTypes()
QueryExpressions getQueryExpressions(ExpressionFactory factory)
ExpressionFactory.
public void assertRoot()
public void assertSelection()
void setContexts(Stack<Context> contexts)
CriteriaQueryImpl<?> getAncestor()
public Map<Selection<?>,String> getAliases()
Context ctx()
public String getAlias(Selection<?> selection)
getAlias in interface AliasContext
public void registerVariable(Selection<?> node,
Value var,
Value path)
registerVariable in interface AliasContextnode - of query treevar - must be a variablepublic boolean isRegistered(Selection<?> selection)
AliasContext
isRegistered in interface AliasContextpublic Value getRegisteredVariable(Selection<?> selection)
AliasContext
getRegisteredVariable in interface AliasContextpublic Value getRegisteredValue(Selection<?> selection)
AliasContext
getRegisteredValue in interface AliasContext
void registerRoot(Root<?> root,
Value var)
root - var - public Value getRegisteredRootVariable(Root<?> root)
getRegisteredRootVariable in interface AliasContextCriteriaQueryImpl<?> getDelegatorParent()
public Class<T> getResultType()
getResultType in interface AbstractQuery<T>public CriteriaQuery<T> multiselect(List<Selection<?>> list)
multiselect in interface CriteriaQuery<T>boolean isMultiselect()
protected boolean isDefaultProjection()
void invalidateCompilation()
public OpenJPACriteriaQuery<T> compile()
compile in interface OpenJPACriteriaQuery<T>public String toCQL()
toCQL in interface OpenJPACriteriaQuery<T>
void render(StringBuilder buffer,
Set<Root<?>> roots,
List<Join<?,?>> correlatedJoins)
public String toString()
Object.toString().
toString in class Objectpublic boolean equals(Object other)
equals in class Object
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||