public class JDOTypesafeQuery<T> extends AbstractTypesafeQuery<T> implements TypesafeQuery<T>
| Modifier and Type | Field and Description |
|---|---|
protected Collection<T> |
candidates |
protected Map<String,Object> |
extensions
Any extensions
|
protected Set<org.datanucleus.store.query.Query> |
internalQueries
Internal queries generated by this typesafe query.
|
protected Map<String,ExpressionImpl> |
parameterExprByName
Map of parameter expression keyed by the name.
|
protected Map<String,Object> |
parameterValuesByName
Map of parameters keyed by their name/expression.
|
protected ExpressionImpl |
rangeLowerExpr
Range : lower limit expression.
|
protected ExpressionImpl |
rangeUpperExpr
Range : upper limit expression.
|
protected Set<JDOTypesafeSubquery> |
subqueries
Set of any subqueries used by this query.
|
candidateAlias, candidateCls, ec, filter, grouping, having, ordering, pm, result, resultDistinct, type, updateExprs, updateValsQUERY_CLASS_PREFIX| Constructor and Description |
|---|
JDOTypesafeQuery(javax.jdo.PersistenceManager pm,
Class<T> candidateClass)
Constructor for a typesafe query.
|
| Modifier and Type | Method and Description |
|---|---|
TypesafeQuery |
addExtension(String key,
Object value)
Add a vendor-specific extension to this query.
|
PersistableExpression |
candidate()
Method to return an expression for the candidate of the query.
|
CharacterExpression |
characterParameter(String name)
Method to return a character parameter for the query.
|
void |
close(Object result)
Method to close the specified query result.
|
void |
closeAll()
Method to close all query results from this query.
|
CollectionExpression |
collectionParameter(String name)
Method to return a collection parameter for the query.
|
org.datanucleus.query.compiler.QueryCompilation |
compile(org.datanucleus.metadata.MetaDataManager mmgr,
org.datanucleus.ClassLoaderResolver clr)
Method to compile the typesafe query.
|
DateExpression |
dateParameter(String name)
Method to return a date parameter for the query.
|
DateTimeExpression |
datetimeParameter(String name)
Method to return a datetime parameter for the query.
|
long |
delete()
Extension method to provide bulk delete capabilities (not part of JDO).
|
long |
deletePersistentAll()
Method to execute the query deleting the affected instances.
|
protected void |
discardCompiled()
Called when something is set on the query making any compilation invalid.
|
NumericExpression<Double> |
doubleParameter(String name)
Method to return a numeric parameter for the query.
|
TypesafeQuery<T> |
excludeSubclasses()
Method to remove subclasses (of the candidate) from the query
|
protected Object |
executeInternalQuery(org.datanucleus.store.query.Query internalQuery) |
<T> List<T> |
executeList()
Method to execute the query where there are (potentially) multiple rows and we are returning
the candidate type.
|
List<Object[]> |
executeResultList(boolean distinct,
Expression... exprs)
Method to execute the query where there are (potentially) multiple rows and we have a result defined
but no result class.
|
List<Object> |
executeResultList(boolean distinct,
Expression expr)
Method to execute the query where there are (potentially) multiple rows and we have a single result defined
but no result class.
|
<R> List<R> |
executeResultList(Class<R> resultCls,
boolean distinct,
Expression... exprs)
Method to execute the query where there are (potentially) multiple rows and we are returning either a
result type or the candidate type.
|
Object[] |
executeResultUnique(boolean distinct,
Expression... exprs)
Method to execute the query where there is a single row and we have a result defined
but no result class.
|
Object |
executeResultUnique(boolean distinct,
Expression expr)
Method to execute the query where there is a single row and we have a single result defined
but no result class.
|
<R> R |
executeResultUnique(Class<R> resultCls,
boolean distinct,
Expression... exprs)
Method to execute the query where there is a single row and we are returning either a result type
or the candidate type.
|
<T> T |
executeUnique()
Method to execute the query where there is a single row and we are returning the candidate type.
|
TypesafeQuery<T> |
filter(BooleanExpression expr)
Method to set the filter of the query.
|
NumericExpression<Float> |
floatParameter(String name)
Method to return a numeric parameter for the query.
|
javax.jdo.FetchPlan |
getFetchPlan()
Accessor for the FetchPlan for this query
|
protected org.datanucleus.store.query.Query |
getInternalQuery()
Convenience method to generate an internal DataNucleus Query and apply the generic compilation to it.
|
javax.jdo.PersistenceManager |
getPersistenceManager()
Accessor for the PersistenceManager for this query
|
static String |
getQueryClassNameForClassName(String name)
Method to return the (simple) name of the query class for a specified class name.
|
TypesafeQuery<T> |
groupBy(Expression... exprs)
Method to set the grouping(s) for the query.
|
TypesafeQuery<T> |
having(Expression expr)
Method to set the having clause of the query.
|
TypesafeQuery<T> |
includeSubclasses()
Method to include subclasses (of the candidate) to the query
|
NumericExpression<Integer> |
integerParameter(String name)
Method to return a numeric parameter for the query.
|
ListExpression |
listParameter(String name)
Method to return a list parameter for the query.
|
NumericExpression<Long> |
longParameter(String name)
Method to return a numeric parameter for the query.
|
MapExpression |
mapParameter(String name)
Method to return a map parameter for the query.
|
TypesafeQuery<T> |
orderBy(OrderExpression... exprs)
Method to set the ordering of the query.
|
Expression |
parameter(String name,
Class type)
Method to return a parameter for the query.
|
TypesafeQuery<T> |
range(Expression paramLowerInclExpr,
Expression paramUpperExclExpr)
Method to set the range of any required results, using parameters (expressions).
|
TypesafeQuery<T> |
range(long lowerIncl,
long upperExcl)
Method to set the range of any required results, using long values.
|
TypesafeQuery<T> |
range(NumericExpression lowerInclExpr,
NumericExpression upperExclExpr)
Method to set the range of any required results, using expressions.
|
TypesafeQuery<T> |
set(Expression expr,
Object val)
Method to specify the update of a field of the candidate.
|
TypesafeQuery<T> |
setCandidates(Collection<T> candidates)
Method to set the candidates to use over which we are querying.
|
TypesafeQuery |
setExtensions(Map<String,Object> extensions)
Set multiple extensions, or use null to clear all extensions.
|
TypesafeQuery |
setIgnoreCache(boolean ignore)
Whether the query should ignore the cache and go straight to the datastore.
|
TypesafeQuery<T> |
setParameter(Expression paramExpr,
Object value)
Method to set a parameter value for use when executing the query.
|
TypesafeQuery<T> |
setParameter(String paramName,
Object value)
Method to set a parameter value for use when executing the query.
|
NumericExpression<Short> |
shortParameter(String name)
Method to return a numeric parameter for the query.
|
StringExpression |
stringParameter(String name)
Method to return a string parameter for the query.
|
<S> TypesafeSubquery<S> |
subquery(Class<S> candidateClass,
String candidateAlias)
Method to return a subquery for use in this query.
|
TypesafeSubquery<T> |
subquery(String candidateAlias)
Method to return a subquery for use in this query using the same candidate class as this query.
|
TimeExpression |
timeParameter(String name)
Method to return a time parameter for the query.
|
String |
toString()
Method to return the single-string form of this JDOQL query.
|
long |
update()
Extension method to provide bulk update capabilities (not part of JDO).
|
Expression |
variable(String name,
Class type)
Method to return a variable for this query.
|
getCompilationprotected Collection<T> candidates
protected ExpressionImpl rangeLowerExpr
protected ExpressionImpl rangeUpperExpr
protected Map<String,ExpressionImpl> parameterExprByName
protected Map<String,Object> parameterValuesByName
protected transient Set<JDOTypesafeSubquery> subqueries
protected transient Set<org.datanucleus.store.query.Query> internalQueries
public PersistableExpression candidate()
TypesafeQuerycandidate in interface TypesafeQuery<T>public Expression parameter(String name, Class type)
TypesafeQueryparameter in interface TypesafeQuery<T>name - Name of the parametertype - Java type of the parameterpublic StringExpression stringParameter(String name)
TypesafeQuerystringParameter in interface TypesafeQuery<T>name - Name of the parameterpublic CharacterExpression characterParameter(String name)
TypesafeQuerycharacterParameter in interface TypesafeQuery<T>name - Name of the parameterpublic NumericExpression<Long> longParameter(String name)
TypesafeQuerylongParameter in interface TypesafeQuery<T>name - Name of the parameterpublic NumericExpression<Integer> integerParameter(String name)
TypesafeQueryintegerParameter in interface TypesafeQuery<T>name - Name of the parameterpublic NumericExpression<Short> shortParameter(String name)
TypesafeQueryshortParameter in interface TypesafeQuery<T>name - Name of the parameterpublic NumericExpression<Double> doubleParameter(String name)
TypesafeQuerydoubleParameter in interface TypesafeQuery<T>name - Name of the parameterpublic NumericExpression<Float> floatParameter(String name)
TypesafeQueryfloatParameter in interface TypesafeQuery<T>name - Name of the parameterpublic DateExpression dateParameter(String name)
TypesafeQuerydateParameter in interface TypesafeQuery<T>name - Name of the parameterpublic TimeExpression timeParameter(String name)
TypesafeQuerytimeParameter in interface TypesafeQuery<T>name - Name of the parameterpublic DateTimeExpression datetimeParameter(String name)
TypesafeQuerydatetimeParameter in interface TypesafeQuery<T>name - Name of the parameterpublic CollectionExpression collectionParameter(String name)
TypesafeQuerycollectionParameter in interface TypesafeQuery<T>name - Name of the parameterpublic MapExpression mapParameter(String name)
TypesafeQuerymapParameter in interface TypesafeQuery<T>name - Name of the parameterpublic ListExpression listParameter(String name)
TypesafeQuerylistParameter in interface TypesafeQuery<T>name - Name of the parameterpublic Expression variable(String name, Class type)
TypesafeQueryvariable in interface TypesafeQuery<T>name - Name of the variabletype - Type of the variablepublic TypesafeQuery<T> excludeSubclasses()
TypesafeQueryexcludeSubclasses in interface TypesafeQuery<T>public TypesafeQuery<T> includeSubclasses()
TypesafeQueryincludeSubclasses in interface TypesafeQuery<T>public TypesafeQuery<T> filter(BooleanExpression expr)
TypesafeQueryfilter in interface TypesafeQuery<T>expr - Filter expressionpublic TypesafeQuery<T> groupBy(Expression... exprs)
TypesafeQuerygroupBy in interface TypesafeQuery<T>exprs - Grouping expression(s)public TypesafeQuery<T> having(Expression expr)
TypesafeQueryhaving in interface TypesafeQuery<T>expr - Having expressionpublic TypesafeQuery<T> orderBy(OrderExpression... exprs)
TypesafeQueryorderBy in interface TypesafeQuery<T>exprs - Ordering expression(s)public TypesafeQuery<T> range(long lowerIncl, long upperExcl)
TypesafeQueryrange in interface TypesafeQuery<T>lowerIncl - The position of the first result (inclusive)upperExcl - The position of the last result (exclusive)public TypesafeQuery<T> range(NumericExpression lowerInclExpr, NumericExpression upperExclExpr)
TypesafeQueryrange in interface TypesafeQuery<T>lowerInclExpr - The position of the first result (inclusive)upperExclExpr - The position of the last result (exclusive)public TypesafeQuery<T> range(Expression paramLowerInclExpr, Expression paramUpperExclExpr)
TypesafeQueryrange in interface TypesafeQuery<T>paramLowerInclExpr - Expression for a parameter defining the position of the first result (inclusive)paramUpperExclExpr - Expression for a parameter defining the position of the last result (exclusive)public <S> TypesafeSubquery<S> subquery(Class<S> candidateClass, String candidateAlias)
TypesafeQuerysubquery in interface TypesafeQuery<T>S - candidate type for subquerycandidateClass - Candidate for the subquerycandidateAlias - Alias for the candidatepublic TypesafeSubquery<T> subquery(String candidateAlias)
TypesafeQuerysubquery in interface TypesafeQuery<T>candidateAlias - Alias for the candidatepublic TypesafeQuery<T> setParameter(Expression paramExpr, Object value)
TypesafeQuerysetParameter in interface TypesafeQuery<T>paramExpr - Parameter expressionvalue - The valuepublic TypesafeQuery<T> setParameter(String paramName, Object value)
TypesafeQuerysetParameter in interface TypesafeQuery<T>paramName - Parameter namevalue - The valuepublic TypesafeQuery<T> setCandidates(Collection<T> candidates)
TypesafeQuerysetCandidates in interface TypesafeQuery<T>candidates - The candidatespublic <T> List<T> executeList()
TypesafeQueryexecuteList in interface TypesafeQuery<T>T - result typepublic <T> T executeUnique()
TypesafeQueryexecuteUnique in interface TypesafeQuery<T>T - result typepublic List<Object[]> executeResultList(boolean distinct, Expression... exprs)
TypesafeQueryexecuteResultList in interface TypesafeQuery<T>distinct - Whether to provide distinct resultsexprs - Result expression(s)public List<Object> executeResultList(boolean distinct, Expression expr)
TypesafeQueryexecuteResultList in interface TypesafeQuery<T>distinct - Whether to provide distinct resultsexpr - Result expressionpublic <R> List<R> executeResultList(Class<R> resultCls, boolean distinct, Expression... exprs)
TypesafeQueryexecuteResultList in interface TypesafeQuery<T>R - result typeresultCls - Result classdistinct - Whether to provide distinct resultsexprs - Result expression(s)public Object[] executeResultUnique(boolean distinct, Expression... exprs)
TypesafeQueryexecuteResultUnique in interface TypesafeQuery<T>distinct - Whether to provide distinct resultsexprs - Result expression(s)public Object executeResultUnique(boolean distinct, Expression expr)
TypesafeQueryexecuteResultUnique in interface TypesafeQuery<T>distinct - Whether to provide distinct resultsexpr - Result expressionpublic <R> R executeResultUnique(Class<R> resultCls, boolean distinct, Expression... exprs)
TypesafeQueryexecuteResultUnique in interface TypesafeQuery<T>R - result typeresultCls - Result classdistinct - Whether to provide distinct resultsexprs - Result expression(s)protected org.datanucleus.store.query.Query getInternalQuery()
protected Object executeInternalQuery(org.datanucleus.store.query.Query internalQuery)
public long deletePersistentAll()
TypesafeQuerydeletePersistentAll in interface TypesafeQuery<T>public TypesafeQuery<T> set(Expression expr, Object val)
expr - Expression for field of the candidateval - The new valuepublic long update()
public long delete()
public javax.jdo.FetchPlan getFetchPlan()
TypesafeQuerygetFetchPlan in interface TypesafeQuery<T>public javax.jdo.PersistenceManager getPersistenceManager()
TypesafeQuerygetPersistenceManager in interface TypesafeQuery<T>public TypesafeQuery setIgnoreCache(boolean ignore)
TypesafeQuerysetIgnoreCache in interface TypesafeQuery<T>ignore - Ignore the cache flagpublic TypesafeQuery addExtension(String key, Object value)
TypesafeQueryaddExtension in interface TypesafeQuery<T>key - the key of the extensionvalue - the value of the extensionpublic TypesafeQuery setExtensions(Map<String,Object> extensions)
TypesafeQuerysetExtensions in interface TypesafeQuery<T>extensions - the map of extensionsTypesafeQuery.addExtension(java.lang.String, java.lang.Object)public void close(Object result)
TypesafeQueryclose in interface TypesafeQuery<T>result - The resultpublic void closeAll()
TypesafeQuerycloseAll in interface TypesafeQuery<T>public org.datanucleus.query.compiler.QueryCompilation compile(org.datanucleus.metadata.MetaDataManager mmgr,
org.datanucleus.ClassLoaderResolver clr)
compile in class AbstractTypesafeQuery<T>mmgr - Metadata managerclr - ClassLoader resolverpublic String toString()
toString in interface TypesafeQuery<T>toString in class Objectprotected void discardCompiled()
discardCompiled in class AbstractTypesafeQuery<T>public static String getQueryClassNameForClassName(String name)
name - Simple name of the class (without package)Copyright © 2015. All rights reserved.