public class JDOQuery extends Object implements javax.jdo.Query, AutoCloseable
Constructor and Description |
---|
JDOQuery(javax.jdo.PersistenceManager pm,
org.datanucleus.store.query.Query query,
String language)
Constructor for a query used by JDO.
|
Modifier and Type | Method and Description |
---|---|
void |
addExtension(String key,
Object value)
Method to add an extension to the query.
|
void |
addSubquery(javax.jdo.Query sub,
String variableDecl,
String candidateExpr)
Add a subquery to this query.
|
void |
addSubquery(javax.jdo.Query sub,
String variableDecl,
String candidateExpr,
Map parameters)
Add a subquery to this query.
|
void |
addSubquery(javax.jdo.Query sub,
String variableDecl,
String candidateExpr,
String... parameters)
Add a subquery to this query.
|
void |
addSubquery(javax.jdo.Query sub,
String variableDecl,
String candidateExpr,
String parameter)
Add a subquery to this query.
|
void |
cancel(Thread thr)
Method to cancel the executing query for the supplied thread.
|
void |
cancelAll()
Method to cancel any executing queries.
|
void |
close() |
void |
close(Object queryResult)
Close the query result.
|
void |
closeAll()
Close all query results for this query.
|
void |
compile()
Compile the query.
|
void |
declareImports(String imports)
Declare any imports for the query.
|
void |
declareParameters(String parameters)
Declare any parameters for the query.
|
void |
declareVariables(String variables)
Declare any variables for the query.
|
long |
deletePersistentAll()
Execute the query deleting all instances found.
|
long |
deletePersistentAll(Map parameters)
Execute the query deleting all instances found.
|
long |
deletePersistentAll(Object... parameters)
Execute the query deleting all instances found.
|
Object |
execute()
Execute the query.
|
Object |
execute(Object p1)
Execute the query.
|
Object |
execute(Object p1,
Object p2)
Execute the query.
|
Object |
execute(Object p1,
Object p2,
Object p3)
Execute the query.
|
Object |
executeWithArray(Object... parameterValues)
Execute the query.
|
Object |
executeWithMap(Map parameters)
Execute the query.
|
javax.jdo.Query |
filter(String filter) |
Integer |
getDatastoreReadTimeoutMillis()
Accessor for the datastore read timeout.
|
Integer |
getDatastoreWriteTimeoutMillis()
Accessor for the datastore write timeout.
|
javax.jdo.FetchPlan |
getFetchPlan()
Accessor for the fetch plan to use.
|
boolean |
getIgnoreCache()
Accessor for the ignore cache setting
|
org.datanucleus.store.query.Query |
getInternalQuery()
Accessor for the internal query.
|
String |
getLanguage()
Accessor for the query language.
|
Object |
getNativeQuery()
Accessor for the native query invoked by this query (if known at this time and supported by the store plugin).
|
javax.jdo.PersistenceManager |
getPersistenceManager()
Accessor for the PersistenceManager.
|
Boolean |
getSerializeRead()
Accessor for whether to serialise any read objects in this query.
|
javax.jdo.Query |
groupBy(String grouping) |
javax.jdo.Query |
having(String having) |
boolean |
isUnmodifiable()
Accessor for whether the query is modifiable.
|
javax.jdo.Query |
orderBy(String ordering) |
javax.jdo.Query |
range(long fromIncl,
long toExcl) |
javax.jdo.Query |
range(String range) |
javax.jdo.Query |
saveAsNamedQuery(String name)
Save this query as a named query with the specified name.
|
void |
setCandidates(Collection pcs)
Set the candidates for the query.
|
void |
setCandidates(javax.jdo.Extent extent)
Set the candidates for the query.
|
void |
setClass(Class candidateClass)
Set the candidate class for the query.
|
void |
setDatastoreReadTimeoutMillis(Integer timeout)
Set the datastore read timeout.
|
void |
setDatastoreWriteTimeoutMillis(Integer timeout)
Set the datastore write timeout.
|
void |
setExtensions(Map extensions)
Set the extensions for the query.
|
void |
setFilter(String filter)
Set the filter for the query.
|
void |
setGrouping(String grouping)
Set the grouping for the query.
|
void |
setIgnoreCache(boolean ignoreCache)
Set the ignore cache setting for the query.
|
void |
setOrdering(String ordering)
Set the ordering for the query.
|
void |
setRange(long fromIncl,
long toExcl)
Set the range for the query.
|
void |
setRange(String range)
Set the range for the query.
|
void |
setResult(String result)
Set the result for the query.
|
void |
setResultClass(Class result_cls)
Set the result class for the query.
|
void |
setSerializeRead(Boolean serialize)
Mutator for whether to serialise any read objects.
|
void |
setUnique(boolean unique)
Set whether to expect a unique result.
|
void |
setUnmodifiable()
Set the query to be unmodifiable.
|
String |
toString()
Convenience method to return the query in string form.
|
public JDOQuery(javax.jdo.PersistenceManager pm, org.datanucleus.store.query.Query query, String language)
pm
- PersistenceManagerquery
- Underlying querylanguage
- Query languagepublic void close()
close
in interface AutoCloseable
public void close(Object queryResult)
close
in interface javax.jdo.Query
queryResult
- Query resultpublic void closeAll()
closeAll
in interface javax.jdo.Query
public void compile()
compile
in interface javax.jdo.Query
public void declareImports(String imports)
declareImports
in interface javax.jdo.Query
imports
- The importspublic void declareParameters(String parameters)
declareParameters
in interface javax.jdo.Query
parameters
- The parameterspublic void declareVariables(String variables)
declareVariables
in interface javax.jdo.Query
variables
- The variablespublic long deletePersistentAll()
deletePersistentAll
in interface javax.jdo.Query
public long deletePersistentAll(Object... parameters)
deletePersistentAll
in interface javax.jdo.Query
parameters
- Parameters to use when executingpublic long deletePersistentAll(Map parameters)
deletePersistentAll
in interface javax.jdo.Query
parameters
- Parameters to use when executingpublic Object execute()
execute
in interface javax.jdo.Query
public Object execute(Object p1)
execute
in interface javax.jdo.Query
p1
- First param valuepublic Object execute(Object p1, Object p2)
execute
in interface javax.jdo.Query
p1
- First param valuep2
- Second param valuepublic Object execute(Object p1, Object p2, Object p3)
execute
in interface javax.jdo.Query
p1
- First param valuep2
- Second param valuep3
- Third param valuepublic Object executeWithArray(Object... parameterValues)
executeWithArray
in interface javax.jdo.Query
parameterValues
- Param valuespublic Object executeWithMap(Map parameters)
executeWithMap
in interface javax.jdo.Query
parameters
- Param valuespublic void cancelAll()
cancelAll
in interface javax.jdo.Query
javax.jdo.JDOUnsupportedOptionException
- if the datastore doesn't support cancellation of queriespublic void cancel(Thread thr)
cancel
in interface javax.jdo.Query
javax.jdo.JDOUnsupportedOptionException
- if the datastore doesn't support cancellation of queriespublic void setCandidates(javax.jdo.Extent extent)
setCandidates
in interface javax.jdo.Query
extent
- Extent defining the candidatespublic void setCandidates(Collection pcs)
setCandidates
in interface javax.jdo.Query
pcs
- PC candidatespublic void setClass(Class candidateClass)
setClass
in interface javax.jdo.Query
candidateClass
- Candidate classpublic void addExtension(String key, Object value)
addExtension
in interface javax.jdo.Query
key
- Key for the extensionvalue
- Value for the extensionpublic void setExtensions(Map extensions)
setExtensions
in interface javax.jdo.Query
extensions
- The extensionspublic javax.jdo.FetchPlan getFetchPlan()
getFetchPlan
in interface javax.jdo.Query
public void setFilter(String filter)
setFilter
in interface javax.jdo.Query
filter
- The query filterpublic void setGrouping(String grouping)
setGrouping
in interface javax.jdo.Query
grouping
- The groupingpublic boolean getIgnoreCache()
getIgnoreCache
in interface javax.jdo.Query
public void setIgnoreCache(boolean ignoreCache)
setIgnoreCache
in interface javax.jdo.Query
ignoreCache
- The ignore cache settingpublic void setOrdering(String ordering)
setOrdering
in interface javax.jdo.Query
ordering
- The orderingpublic javax.jdo.PersistenceManager getPersistenceManager()
getPersistenceManager
in interface javax.jdo.Query
public void setRange(String range)
setRange
in interface javax.jdo.Query
range
- The range specificationpublic void setRange(long fromIncl, long toExcl)
setRange
in interface javax.jdo.Query
fromIncl
- From range inclusivetoExcl
- To range exclusivepublic void setResult(String result)
setResult
in interface javax.jdo.Query
result
- Result clausepublic void setResultClass(Class result_cls)
setResultClass
in interface javax.jdo.Query
result_cls
- Result classpublic void setDatastoreReadTimeoutMillis(Integer timeout)
setDatastoreReadTimeoutMillis
in interface javax.jdo.Query
timeout
- Timeout interval (millisecs)public Integer getDatastoreReadTimeoutMillis()
getDatastoreReadTimeoutMillis
in interface javax.jdo.Query
public void setDatastoreWriteTimeoutMillis(Integer timeout)
setDatastoreWriteTimeoutMillis
in interface javax.jdo.Query
timeout
- Timeout interval (millisecs)public Integer getDatastoreWriteTimeoutMillis()
getDatastoreWriteTimeoutMillis
in interface javax.jdo.Query
public void setUnique(boolean unique)
setUnique
in interface javax.jdo.Query
unique
- Whether results are uniquepublic boolean isUnmodifiable()
isUnmodifiable
in interface javax.jdo.Query
public void setUnmodifiable()
setUnmodifiable
in interface javax.jdo.Query
public void addSubquery(javax.jdo.Query sub, String variableDecl, String candidateExpr)
addSubquery
in interface javax.jdo.Query
sub
- the subquery to add to this QueryvariableDecl
- the name of the variable in the outer query to bind the results of the subquerycandidateExpr
- the candidate collection of the subquery as an expression using terms of the outer querypublic void addSubquery(javax.jdo.Query sub, String variableDecl, String candidateExpr, String parameter)
addSubquery
in interface javax.jdo.Query
sub
- the subquery to add to this QueryvariableDecl
- the name of the variable to be used in this QuerycandidateExpr
- the candidate collection to apply to the subqueryparameter
- the expression from the outer query to bind the parameter in the subquerypublic void addSubquery(javax.jdo.Query sub, String variableDecl, String candidateExpr, String... parameters)
addSubquery
in interface javax.jdo.Query
sub
- the subquery to add to this QueryvariableDecl
- the name of the variable to be used in this QuerycandidateExpr
- the candidate collection to apply to the subqueryparameters
- the expressions from the outer query to bind the parameter in the subquerypublic void addSubquery(javax.jdo.Query sub, String variableDecl, String candidateExpr, Map parameters)
addSubquery
in interface javax.jdo.Query
sub
- the subquery to add to this QueryvariableDecl
- the name of the variable to be used in this QuerycandidateExpr
- the candidate collection to apply to the subqueryparameters
- the expressions from the outer query to bind the parameter in the subquerypublic Boolean getSerializeRead()
getSerializeRead
in interface javax.jdo.Query
public void setSerializeRead(Boolean serialize)
setSerializeRead
in interface javax.jdo.Query
serialize
- Whether to serialise any read objects in this query.public org.datanucleus.store.query.Query getInternalQuery()
public String getLanguage()
public javax.jdo.Query saveAsNamedQuery(String name)
name
- The name to refer to it underpublic String toString()
public Object getNativeQuery()
public javax.jdo.Query filter(String filter)
public javax.jdo.Query groupBy(String grouping)
public javax.jdo.Query having(String having)
public javax.jdo.Query orderBy(String ordering)
public javax.jdo.Query range(long fromIncl, long toExcl)
public javax.jdo.Query range(String range)
Copyright © 2017. All rights reserved.