|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.datanucleus.jdo.query.AbstractTypesafeQuery<T>
org.datanucleus.jdo.query.JDOTypesafeQuery<T>
public class JDOTypesafeQuery<T>
Implementation of a typesafe Query for JDO.
| Field Summary | |
|---|---|
protected java.util.Collection<T> |
candidates
|
protected java.util.Map<java.lang.String,java.lang.Object> |
extensions
Any extensions |
protected java.util.HashSet<Query> |
internalQueries
Internal queries generated by this typesafe query. |
protected java.util.Map<java.lang.String,ExpressionImpl> |
parameterExprByName
Map of parameter expression keyed by the name. |
protected java.util.Map<java.lang.String,java.lang.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 java.util.HashSet<JDOTypesafeSubquery> |
subqueries
Set of any subqueries used by this query. |
| Fields inherited from class org.datanucleus.jdo.query.AbstractTypesafeQuery |
|---|
candidateAlias, candidateCls, filter, grouping, having, om, ordering, pm, result, resultDistinct |
| Fields inherited from interface org.datanucleus.query.typesafe.TypesafeQuery |
|---|
QUERY_CLASS_PREFIX |
| Constructor Summary | |
|---|---|
JDOTypesafeQuery(javax.jdo.PersistenceManager pm,
java.lang.Class<T> candidateClass)
Constructor for a typesafe query. |
|
| Method Summary | ||
|---|---|---|
TypesafeQuery |
addExtension(java.lang.String key,
java.lang.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(java.lang.String name)
Method to return a character parameter for the query. |
|
void |
close(java.lang.Object result)
Method to close the specified query result. |
|
void |
closeAll()
Method to close all query results from this query. |
|
CollectionExpression |
collectionParameter(java.lang.String name)
Method to return a collection parameter for the query. |
|
QueryCompilation |
compile(MetaDataManager mmgr,
ClassLoaderResolver clr)
Method to compile the typesafe query. |
|
DateExpression<java.sql.Date> |
dateParameter(java.lang.String name)
Method to return a date parameter for the query. |
|
DateTimeExpression<java.util.Date> |
datetimeParameter(java.lang.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<java.lang.Double> |
doubleParameter(java.lang.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 java.lang.Object |
executeInternalQuery(Query internalQuery)
|
|
|
executeList()
Method to execute the query where there are (potentially) multiple rows and we are returning the candidate type. |
|
java.util.List<java.lang.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. |
|
|
executeResultList(java.lang.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. |
|
java.lang.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. |
|
|
executeResultUnique(java.lang.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. |
|
|
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<java.lang.Float> |
floatParameter(java.lang.String name)
Method to return a numeric parameter for the query. |
|
javax.jdo.FetchPlan |
getFetchPlan()
Accessor for the FetchPlan for this query |
|
protected 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 java.lang.String |
getQueryClassNameForClassName(java.lang.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<java.lang.Integer> |
integerParameter(java.lang.String name)
Method to return a numeric parameter for the query. |
|
ListExpression |
listParameter(java.lang.String name)
Method to return a list parameter for the query. |
|
NumericExpression<java.lang.Long> |
longParameter(java.lang.String name)
Method to return a numeric parameter for the query. |
|
MapExpression |
mapParameter(java.lang.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(java.lang.String name,
java.lang.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> |
setCandidates(java.util.Collection<T> candidates)
Method to set the candidates to use over which we are querying. |
|
TypesafeQuery |
setExtensions(java.util.Map<java.lang.String,java.lang.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,
java.lang.Object value)
Method to set a parameter value for use when executing the query. |
|
TypesafeQuery<T> |
setParameter(java.lang.String paramName,
java.lang.Object value)
Method to set a parameter value for use when executing the query. |
|
NumericExpression<java.lang.Short> |
shortParameter(java.lang.String name)
Method to return a numeric parameter for the query. |
|
StringExpression |
stringParameter(java.lang.String name)
Method to return a string parameter for the query. |
|
|
subquery(java.lang.Class<S> candidateClass,
java.lang.String candidateAlias)
Method to return a subquery for use in this query. |
|
TypesafeSubquery<T> |
subquery(java.lang.String candidateAlias)
Method to return a subquery for use in this query using the same candidate class as this query. |
|
TimeExpression<java.sql.Time> |
timeParameter(java.lang.String name)
Method to return a time parameter for the query. |
|
java.lang.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(java.lang.String name,
java.lang.Class type)
Method to return a variable for this query. |
|
| Methods inherited from class org.datanucleus.jdo.query.AbstractTypesafeQuery |
|---|
getCompilation |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
protected java.util.Collection<T> candidates
protected ExpressionImpl rangeLowerExpr
protected ExpressionImpl rangeUpperExpr
protected java.util.Map<java.lang.String,java.lang.Object> extensions
protected java.util.Map<java.lang.String,ExpressionImpl> parameterExprByName
protected java.util.Map<java.lang.String,java.lang.Object> parameterValuesByName
protected transient java.util.HashSet<JDOTypesafeSubquery> subqueries
protected transient java.util.HashSet<Query> internalQueries
| Constructor Detail |
|---|
public JDOTypesafeQuery(javax.jdo.PersistenceManager pm,
java.lang.Class<T> candidateClass)
pm - Persistence ManagercandidateClass - The candidate class| Method Detail |
|---|
public PersistableExpression candidate()
TypesafeQuery
candidate in interface TypesafeQuery<T>
public Expression parameter(java.lang.String name,
java.lang.Class type)
TypesafeQuery
parameter in interface TypesafeQuery<T>name - Name of the parametertype - Java type of the parameter
public StringExpression stringParameter(java.lang.String name)
TypesafeQuery
stringParameter in interface TypesafeQuery<T>name - Name of the parameter
public CharacterExpression characterParameter(java.lang.String name)
TypesafeQuery
characterParameter in interface TypesafeQuery<T>name - Name of the parameter
public NumericExpression<java.lang.Long> longParameter(java.lang.String name)
TypesafeQuery
longParameter in interface TypesafeQuery<T>name - Name of the parameter
public NumericExpression<java.lang.Integer> integerParameter(java.lang.String name)
TypesafeQuery
integerParameter in interface TypesafeQuery<T>name - Name of the parameter
public NumericExpression<java.lang.Short> shortParameter(java.lang.String name)
TypesafeQuery
shortParameter in interface TypesafeQuery<T>name - Name of the parameter
public NumericExpression<java.lang.Double> doubleParameter(java.lang.String name)
TypesafeQuery
doubleParameter in interface TypesafeQuery<T>name - Name of the parameter
public NumericExpression<java.lang.Float> floatParameter(java.lang.String name)
TypesafeQuery
floatParameter in interface TypesafeQuery<T>name - Name of the parameter
public DateExpression<java.sql.Date> dateParameter(java.lang.String name)
TypesafeQuery
dateParameter in interface TypesafeQuery<T>name - Name of the parameter
public TimeExpression<java.sql.Time> timeParameter(java.lang.String name)
TypesafeQuery
timeParameter in interface TypesafeQuery<T>name - Name of the parameter
public DateTimeExpression<java.util.Date> datetimeParameter(java.lang.String name)
TypesafeQuery
datetimeParameter in interface TypesafeQuery<T>name - Name of the parameter
public CollectionExpression collectionParameter(java.lang.String name)
TypesafeQuery
collectionParameter in interface TypesafeQuery<T>name - Name of the parameter
public MapExpression mapParameter(java.lang.String name)
TypesafeQuery
mapParameter in interface TypesafeQuery<T>name - Name of the parameter
public ListExpression listParameter(java.lang.String name)
TypesafeQuery
listParameter in interface TypesafeQuery<T>name - Name of the parameter
public Expression variable(java.lang.String name,
java.lang.Class type)
TypesafeQuery
variable in interface TypesafeQuery<T>name - Name of the variabletype - Type of the variable
public TypesafeQuery<T> excludeSubclasses()
TypesafeQuery
excludeSubclasses in interface TypesafeQuery<T>public TypesafeQuery<T> includeSubclasses()
TypesafeQuery
includeSubclasses in interface TypesafeQuery<T>public TypesafeQuery<T> filter(BooleanExpression expr)
TypesafeQuery
filter in interface TypesafeQuery<T>expr - Filter expression
public TypesafeQuery<T> groupBy(Expression... exprs)
TypesafeQuery
groupBy in interface TypesafeQuery<T>exprs - Grouping expression(s)
public TypesafeQuery<T> having(Expression expr)
TypesafeQuery
having in interface TypesafeQuery<T>expr - Having expression
public TypesafeQuery<T> orderBy(OrderExpression... exprs)
TypesafeQuery
orderBy in interface TypesafeQuery<T>exprs - Ordering expression(s)
public TypesafeQuery<T> range(long lowerIncl,
long upperExcl)
TypesafeQuery
range 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)
TypesafeQuery
range 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)
TypesafeQuery
range 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(java.lang.Class<S> candidateClass,
java.lang.String candidateAlias)
TypesafeQuery
subquery in interface TypesafeQuery<T>candidateClass - Candidate for the subquerycandidateAlias - Alias for the candidate
public TypesafeSubquery<T> subquery(java.lang.String candidateAlias)
TypesafeQuery
subquery in interface TypesafeQuery<T>candidateAlias - Alias for the candidate
public TypesafeQuery<T> setParameter(Expression paramExpr,
java.lang.Object value)
TypesafeQuery
setParameter in interface TypesafeQuery<T>paramExpr - Parameter expressionvalue - The value
public TypesafeQuery<T> setParameter(java.lang.String paramName,
java.lang.Object value)
TypesafeQuery
setParameter in interface TypesafeQuery<T>paramName - Parameter namevalue - The value
public TypesafeQuery<T> setCandidates(java.util.Collection<T> candidates)
TypesafeQuery
setCandidates in interface TypesafeQuery<T>candidates - The candidates
public <T> java.util.List<T> executeList()
TypesafeQuery
executeList in interface TypesafeQuery<T>public <T> T executeUnique()
TypesafeQuery
executeUnique in interface TypesafeQuery<T>
public java.util.List<java.lang.Object[]> executeResultList(boolean distinct,
Expression... exprs)
TypesafeQuery
executeResultList in interface TypesafeQuery<T>distinct - Whether to provide distinct resultsexprs - Result expression(s)
public <R> java.util.List<R> executeResultList(java.lang.Class<R> resultCls,
boolean distinct,
Expression... exprs)
TypesafeQuery
executeResultList in interface TypesafeQuery<T>resultCls - Result classdistinct - Whether to provide distinct resultsexprs - Result expression(s)
public java.lang.Object[] executeResultUnique(boolean distinct,
Expression... exprs)
TypesafeQuery
executeResultUnique in interface TypesafeQuery<T>distinct - Whether to provide distinct resultsexprs - Result expression(s)
public <R> R executeResultUnique(java.lang.Class<R> resultCls,
boolean distinct,
Expression... exprs)
TypesafeQuery
executeResultUnique in interface TypesafeQuery<T>resultCls - Result classdistinct - Whether to provide distinct resultsexprs - Result expression(s)
protected Query getInternalQuery()
protected java.lang.Object executeInternalQuery(Query internalQuery)
public long deletePersistentAll()
TypesafeQuery
deletePersistentAll in interface TypesafeQuery<T>public long update()
public long delete()
public javax.jdo.FetchPlan getFetchPlan()
TypesafeQuery
getFetchPlan in interface TypesafeQuery<T>public javax.jdo.PersistenceManager getPersistenceManager()
TypesafeQuery
getPersistenceManager in interface TypesafeQuery<T>public TypesafeQuery setIgnoreCache(boolean ignore)
TypesafeQuery
setIgnoreCache in interface TypesafeQuery<T>ignore - Ignore the cache flag
public TypesafeQuery addExtension(java.lang.String key,
java.lang.Object value)
TypesafeQuery
addExtension in interface TypesafeQuery<T>key - the key of the extensionvalue - the value of the extension
public TypesafeQuery setExtensions(java.util.Map<java.lang.String,java.lang.Object> extensions)
TypesafeQuery
setExtensions in interface TypesafeQuery<T>extensions - the map of extensions
TypesafeQuery.addExtension(java.lang.String, java.lang.Object)public void close(java.lang.Object result)
TypesafeQuery
close in interface TypesafeQuery<T>result - The resultpublic void closeAll()
TypesafeQuery
closeAll in interface TypesafeQuery<T>
public QueryCompilation compile(MetaDataManager mmgr,
ClassLoaderResolver clr)
compile in class AbstractTypesafeQuery<T>mmgr - Metadata managerclr - ClassLoader resolver
public java.lang.String toString()
toString in interface TypesafeQuery<T>toString in class java.lang.Objectprotected void discardCompiled()
discardCompiled in class AbstractTypesafeQuery<T>public static java.lang.String getQueryClassNameForClassName(java.lang.String name)
name - Simple name of the class (without package)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||