|
Oracle Application Server TopLink API Reference 10g Release 2 (10.1.2) B15903-01 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object
oracle.toplink.jdo.JDOQuery
PROTOTYPE: JDO wrapper for a TopLink query.
Constructor Summary | |
JDOQuery(JDOPersistenceManager manager) JDOQuery constructor comment. |
Method Summary | |
void |
acquireLocks() PUBLIC: Set the query to lock, this will also turn refreshCache on. |
void |
acquireLocksWithoutWaiting() PUBLIC: Set the query to lock without waiting (blocking), this will also turn refreshCache on. |
void |
addArgument(java.lang.String argumentName) PUBLIC: Add the argument named argumentName. |
void |
addAscendingOrdering(java.lang.String queryKeyName) PUBLIC: Order the query results by the object's attribute or query key name. |
void |
addAttribute(java.lang.String itemName) PUBLIC: Add the attribute from the reference class to be included in the result. |
void |
addAttribute(java.lang.String itemName, Expression attributeExpression) PUBLIC: Add the attribute to be included in the result. |
void |
addAverage(java.lang.String itemName) PUBLIC: Add the average value of the attribute to be included in the result. |
void |
addAverage(java.lang.String itemName, Expression attributeExpression) PUBLIC: Add the average value of the attribute to be included in the result. |
void |
addBatchReadAttribute(Expression attributeExpression) PUBLIC: Specify the foreign-reference mapped attribute to be optimized in this query. |
void |
addBatchReadAttribute(java.lang.String attributeName) PUBLIC: Specify the foreign-reference mapped attribute to be optimized in this query. |
void |
addCount() PUBLIC: Add the count of the size of the result to be included in the result. |
void |
addCount(java.lang.String itemName) PUBLIC: Add the count of the size of the result to be included in the result. |
void |
addCount(java.lang.String itemName, Expression attributeExpression) PUBLIC: Add the count of the size of the result to be included in the result. |
void |
addDescendingOrdering(java.lang.String queryKeyName) PUBLIC: Order the query results by the object's attribute or query key name. |
void |
addGrouping(Expression expression) PUBLIC: Add the attribute expression to the group by expressions. |
void |
addGrouping(java.lang.String attributeName) PUBLIC: Add the attribute to the group by expressions. |
void |
addItem(java.lang.String itemName, Expression attributeExpression) ADVANCED: Add the expression value to be included in the result. |
void |
addJoinedAttribute(Expression attributeExpression) PUBLIC: Specify the one-to-one mapped attribute to be optimized in this query. |
void |
addJoinedAttribute(java.lang.String attributeName) PUBLIC: Specify the one-to-one mapped attribute to be optimized in this query. |
void |
addMaximum(java.lang.String itemName) PUBLIC: Add the maximum value of the attribute to be included in the result. |
void |
addMaximum(java.lang.String itemName, Expression attributeExpression) PUBLIC: Add the maximum value of the attribute to be included in the result. |
void |
addMinimum(java.lang.String itemName) PUBLIC: Add the minimum value of the attribute to be included in the result. |
void |
addMinimum(java.lang.String itemName, Expression attributeExpression) PUBLIC: Add the minimum value of the attribute to be included in the result. |
void |
addOrdering(Expression orderingExpression) PUBLIC: Add the ordering expression. |
void |
addPartialAttribute(Expression attributeExpression) PUBLIC: Specify that only a subset of the class' attributes be selected in this query. |
void |
addPartialAttribute(java.lang.String attributeName) PUBLIC: Specify that only a subset of the class' attributes be selected in this query. |
void |
addStandardDeviation(java.lang.String itemName) PUBLIC: Add the standard deviation value of the attribute to be included in the result. |
void |
addStandardDeviation(java.lang.String itemName, Expression attributeExpression) PUBLIC: Add the standard deviation value of the attribute to be included in the result. |
void |
addSum(java.lang.String itemName) PUBLIC: Add the sum value of the attribute to be included in the result. |
void |
addSum(java.lang.String itemName, Expression attributeExpression) PUBLIC: Add the sum value of the attribute to be included in the result. |
void |
addVariance(java.lang.String itemName) PUBLIC: Add the variance value of the attribute to be included in the result. |
void |
addVariance(java.lang.String itemName, Expression attributeExpression) PUBLIC: Add the variance value of the attribute to be included in the result. |
void |
asReadAllQuery() PUBLIC: Reset the TOPLink query to be a new ReadAllQuery. |
void |
asReadObjectQuery() PUBLIC: Reset the TOPLink query to be a new ReadObjectQuery. |
void |
asReportQuery() PUBLIC: Reset the TOPLink query to be a new ReportQuery. |
void |
bindAllParameters() Bind all arguments to any SQL statement. |
void |
cacheStatement() Cache the prepared statements, this requires full parameter binding as well. |
void |
cascadeAllParts() PUBLIC: Cascade the query and its properties on the queries object(s) and all objects related to the queries object(s). |
void |
cascadePrivateParts() PUBLIC: Cascade the query and its properties on the queries object(s) and all privately owned objects related to the queries object(s). |
void |
checkCacheByExactPrimaryKey() PUBLIC: The cache will be checked only if the query contains exactly the primary key. |
void |
checkCacheByPrimaryKey() PUBLIC: This is the default, the cache will be checked only if the query contains the primary key. |
void |
checkCacheOnly() PUBLIC: The cache will checked completely, if the object is not found null will be returned or an error if the query is too complex. |
void |
checkCacheThenDatabase() PUBLIC: The cache will be checked completely, then if the object is not found or the query too complex the database will be queried. |
void |
close(java.lang.Object queryResult) Close a query result and release any resources associated with it. |
void |
closeAll() Close all query results associated with this Query instance, and release all resources associated with them. |
void |
compile() Verify the elements of the query and provide a hint to the query to prepare and optimize an execution plan. |
void |
conformResultsInUnitOfWork() PUBLIC: The cache will checked completely, if the object is not found the database will be queried, and the database result will be verified with what is in the cache and/or unit of work including new objects. |
void |
declareImports(java.lang.String arg1) Set the import statements to be used to identify the fully qualified name of variables or parameters. |
void |
declareParameters(java.lang.String parameters) Declare the list of parameters query execution. |
void |
declareVariables(java.lang.String arg1) Declare the unbound variables to be used in the query. |
void |
dontAcquireLocks() PUBLIC: Set the query not to lock. |
void |
dontBindAllParameters() Do not Bind all arguments to any SQL statement. |
void |
dontCacheStatement() Dont cache the prepared statements, this requires full parameter binding as well. |
void |
dontCascadeParts() PUBLIC: Do not cascade the query and its properties on the queries object(s) relationships. |
void |
dontCheckCache() PUBLIC: This can be used to explicitly disable the cache hit. |
void |
dontMaintainCache() PUBLIC: Set for the identity map (cache) to be ignored completely. |
void |
dontRefreshIdentityMapResult() PUBLIC: When unset means perform read normally and dont do refresh. |
void |
dontRefreshRemoteIdentityMapResult() PUBLIC: When unset means perform read normally and dont do refresh. |
void |
dontUseDistinct() ADVANCED: If a distinct has been set the DISTINCT clause will be printed. |
java.lang.Object |
execute() Execute the query and return the filtered Collection. |
java.lang.Object |
execute(java.lang.Object arg1) Execute the query and return the filtered Collection. |
java.lang.Object |
execute(java.lang.Object arg1, java.lang.Object arg2) Execute the query and return the filtered Collection. |
java.lang.Object |
execute(java.lang.Object arg1, java.lang.Object arg2, java.lang.Object arg3) Execute the query and return the filtered Collection. |
java.lang.Object |
executeWithArray(java.lang.Object[] arg1) Execute the query and return the filtered Collection. |
java.lang.Object |
executeWithMap(java.util.Map arg1) Execute the query and return the filtered Collection. |
oracle.toplink.internal.databaseaccess.DatabaseCall |
getCall() ADVANCED: Return the call for this query. |
java.lang.Object |
getExampleObject() PUBLIC: This method returns the current example object. |
ExpressionBuilder |
getExpressionBuilder() Return the query's expression builder. |
boolean |
getIgnoreCache() Get the ignoreCache option setting. |
javax.jdo.PersistenceManager |
getPersistenceManager() Get the PersistenceManager associated with this Query. |
DatabaseQuery |
getQuery() Return the associated TopLink query. |
int |
getQueryTimeout() PUBLIC: Return the number of seconds the driver will wait for a Statement to execute to the given number of seconds. |
ReadAllQuery |
getReadAllQuery() Return the associated TopLink ReadAllQuery. |
ReadObjectQuery |
getReadObjectQuery() Return the associated TopLink ReadObjectQuery. |
java.lang.Class |
getReferenceClass() PUBLIC: Return the domain class associated with this query. |
ReportQuery |
getReportQuery() Return the associated TopLink ReportQuery. |
Expression |
getSelectionCriteria() PUBLIC: Return the selection criteria of the query. |
void |
maintainCache() PUBLIC: Set for the identity map (cache) to be maintained. |
void |
refreshIdentityMapResult() PUBLIC: Refresh the attributes of the object(s) resulting from the query. |
void |
setCall(Call call) PUBLIC: Used to define a store procedure or SQL query. |
void |
setCandidates(java.util.Collection arg1) Set the candidate Collection to query. |
void |
setCandidates(javax.jdo.Extent arg1) Set the candidate Extent to query. |
void |
setClass(java.lang.Class queryClass) Set the class of the candidate instances of the query. |
void |
setEJBQLString(java.lang.String ejbqlString) Set the filter to an EJBQL string. |
void |
setFilter(Expression selectionCriteria) Set the filter to a TopLink expression. |
void |
setFilter(java.lang.String arg1) JDO-QL is not currently supported. |
void |
setIgnoreCache(boolean shouldMaintainCache) Sets maintainCache in the TopLink query, if set this will by-pass the cache. |
void |
setOrdering(java.lang.String attribute) The JDO order clause is not currently supported. |
void |
setQuery(DatabaseQuery newQuery) Set the associated TopLink query. |
void |
setQueryByExampleFilter(java.lang.Object exampleObject) Set the filter based on the query by example object. |
void |
setQueryByExamplePolicy(QueryByExamplePolicy newPolicy) PUBLIC: Policy, an instance of oracle.toplink.queryframework.QueryByExamplePolicy, is a useful tool to customising the query when Query By Example is used. |
void |
setQueryTimeout(int queryTimeout) PUBLIC: Set the number of seconds the driver will wait for a Statement to execute to the given number of seconds. |
void |
setShouldBindAllParameters(boolean shouldBindAllParameters) Bind all arguments to any SQL statement. |
void |
setShouldCacheStatement(boolean shouldCacheStatement) Cache the prepared statements, this requires full parameter binding as well. |
void |
setShouldMaintainCache(boolean shouldMaintainCache) PUBLIC: Set if the identity map (cache) should be used or not. |
void |
setShouldRefreshIdentityMapResult(boolean shouldRefreshIdentityMapResult) PUBLIC: Set if the attributes of the object(s) resulting from the query should be refreshed. |
void |
setSQLString(java.lang.String sqlString) PUBLIC: To any user of this object. |
boolean |
shouldBindAllParameters() Bind all arguments to any SQL statement. |
boolean |
shouldCacheStatement() Cache the prepared statements, this requires full parameter binding as well. |
boolean |
shouldCascadeAllParts() PUBLIC: Flag used to determine if all parts should be cascaded |
boolean |
shouldCascadeParts() PUBLIC: Flag used to determine if any parts should be cascaded |
boolean |
shouldCascadePrivateParts() PUBLIC: Flag used to determine if any private parts should be cascaded |
boolean |
shouldMaintainCache() PUBLIC: Return if the identity map (cache) should be used or not. |
boolean |
shouldRefreshIdentityMapResult() PUBLIC: Set to a boolean. |
void |
useCollectionClass(java.lang.Class concreteClass) PUBLIC: Configure the mapping to use an instance of the specified container class to hold the target objects. |
void |
useCursoredStream() PUBLIC: Use a CursoredStream as the result collection. |
void |
useCursoredStream(int initialReadSize, int pageSize) PUBLIC: Use a CursoredStream as the result collection. |
void |
useCursoredStream(int initialReadSize, int pageSize, ValueReadQuery sizeQuery) PUBLIC: Use a CursoredStream as the result collection. |
void |
useDistinct() ADVANCED: If a distinct has been set the DISTINCT clause will be printed. |
void |
useMapClass(java.lang.Class concreteClass, java.lang.String methodName) PUBLIC: Configure the query to use an instance of the specified container class to hold the result objects. |
void |
useScrollableCursor() PUBLIC: Use a ScrollableCursor as the result collection. |
void |
useScrollableCursor(int pageSize) PUBLIC: Use a ScrollableCursor as the result collection. |
Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public JDOQuery(JDOPersistenceManager manager)
Method Detail |
public void compile()
compile
in interface javax.jdo.Query
public void declareImports(java.lang.String arg1)
The String parameter to this method follows the syntax of the import statement of the Java language.
declareImports
in interface javax.jdo.Query
public void declareParameters(java.lang.String parameters)
The String parameter to this method follows the syntax for formal parameters in the Java language.
declareParameters
in interface javax.jdo.Query
parameters
- the list of parameters separated by commas.public void declareVariables(java.lang.String arg1)
declareVariables
in interface javax.jdo.Query
public java.lang.Object execute()
execute
in interface javax.jdo.Query
executeWithArray(Object[] parameters)
public java.lang.Object execute(java.lang.Object arg1)
execute
in interface javax.jdo.Query
executeWithArray(Object[] parameters)
public java.lang.Object execute(java.lang.Object arg1, java.lang.Object arg2)
execute
in interface javax.jdo.Query
executeWithArray(Object[] parameters)
public java.lang.Object execute(java.lang.Object arg1, java.lang.Object arg2, java.lang.Object arg3)
execute
in interface javax.jdo.Query
executeWithArray(Object[] parameters)
public java.lang.Object executeWithArray(java.lang.Object[] arg1)
The execution of the query obtains the values of the parameters and matches them against the declared parameters in order. The names of the declared parameters are ignored. The type of the declared parameters must match the type of the passed parameters, except that the passed parameters might need to be unwrapped to get their primitive values.
The filter, import, declared parameters, declared variables, and ordering statements are verified for consistency.
Each element in the candidate Collection is examined to see that it is assignment compatible to the Class of the query. It is then evaluated by the boolean expression of the filter. The element passes the filter if there exist unique values for all variables for which the filter expression evaluates to true.
executeWithArray
in interface javax.jdo.Query
public boolean getIgnoreCache()
getIgnoreCache
in interface javax.jdo.Query
setIgnoreCache(boolean)
public javax.jdo.PersistenceManager getPersistenceManager()
If this Query was restored from a serialized form, it has no PersistenceManager, and this method returns null.
getPersistenceManager
in interface javax.jdo.Query
public void setCandidates(javax.jdo.Extent arg1)
setCandidates
in interface javax.jdo.Query
public void setClass(java.lang.Class queryClass)
The class specifies the class of the candidates of the query. Elements of the candidate collection that are of the specified class are filtered before being put into the result Collection.
setClass
in interface javax.jdo.Query
public void setFilter(java.lang.String arg1)
JDO: Set the filter for the query.
The filter specification is a String containing a boolean expression that is to be evaluated for each of the instances in the candidate collection. If the filter is not specified, then it defaults to "true", which has the effect of filtering the input Collection only for class type.
An element of the candidate collection is returned in the result if:
The user may denote uniqueness in the filter expression by explicitly declaring an expression (for example, e1 != e2).
Rules for constructing valid expressions follow the Java language, except for these differences:
Identifiers in the expression are considered to be in the name space of the specified class, with the addition of declared imports, parameters and variables. As in the Java language, this is a reserved word which means the element of the collection being evaluated.
Navigation through single-valued fields is specified by the Java language syntax of field_name.field_name....field_name.
A JDO implementation is allowed to reorder the filter expression for optimization purposes.
setFilter
in interface javax.jdo.Query
public void setIgnoreCache(boolean shouldMaintainCache)
JDO: Set the ignoreCache option. The default value for this option was set by the PersistenceManagerFactory or the PersistenceManager used to create this Query. The ignoreCache option setting specifies whether the query should execute entirely in the back end, instead of in the cache. If this flag is set to true, an implementation might be able to optimize the query execution by ignoring changed values in the cache. For optimistic transactions, this can dramatically improve query response times.
setIgnoreCache
in interface javax.jdo.Query
public void setOrdering(java.lang.String attribute)
Each ordering declaration is the name of the field on which to order the results followed by one of the following words: "ascending" or "descending".
The field must be declared in the candidate class or must be a navigation expression starting with a field in the candidate class.
Valid field types are primitive types except boolean; wrapper types except Boolean; BigDecimal; BigInteger; String; and Date.
setOrdering
in interface javax.jdo.Query
public void acquireLocks()
public void acquireLocksWithoutWaiting()
public void addArgument(java.lang.String argumentName)
public void addAscendingOrdering(java.lang.String queryKeyName)
public void addAttribute(java.lang.String itemName)
public void addAttribute(java.lang.String itemName, Expression attributeExpression)
public void addAverage(java.lang.String itemName)
public void addAverage(java.lang.String itemName, Expression attributeExpression)
public void addBatchReadAttribute(java.lang.String attributeName)
Example: query.addBatchReadAttribute("phoneNumbers")
addBatchReadAttribute(Expression)
, ObjectLevelReadQuery.addJoinedAttribute(String)
public void addBatchReadAttribute(Expression attributeExpression)
Example: query.addBatchReadAttribute(query.getExpressionBuilder().get("policies").get("claims"))
ObjectLevelReadQuery.addJoinedAttribute(String)
public void addCount()
public void addCount(java.lang.String itemName)
public void addCount(java.lang.String itemName, Expression attributeExpression)
public void addDescendingOrdering(java.lang.String queryKeyName)
public void addGrouping(java.lang.String attributeName)
public void addGrouping(Expression expression)
public void addItem(java.lang.String itemName, Expression attributeExpression)
public void addJoinedAttribute(java.lang.String attributeName)
Note: This cannot be used for objects where it is possible not to have a part, as these objects will be ommited from the result set, unless an outer join is used through passing and expression using "getAllowingNull".
Example: query.addJoinedAttribute("address")
addJoinedAttribute(Expression)
, ReadAllQuery.addBatchReadAttribute(Expression)
public void addJoinedAttribute(Expression attributeExpression)
Note: This cannot be used for objects where it is possible not to have a part, as these objects will be ommited from the result set, unless an outer join is used through passing and expression using "getAllowingNull".
Example: query.addJoinedAttribute(query.getExpressionBuilder().get("teamLeader").get("address"))
ReadAllQuery.addBatchReadAttribute(String)
public void addMaximum(java.lang.String itemName)
public void addMaximum(java.lang.String itemName, Expression attributeExpression)
public void addMinimum(java.lang.String itemName)
public void addMinimum(java.lang.String itemName, Expression attributeExpression)
public void addOrdering(Expression orderingExpression)
public void addPartialAttribute(java.lang.String attributeName)
public void addPartialAttribute(Expression attributeExpression)
public void addStandardDeviation(java.lang.String itemName)
public void addStandardDeviation(java.lang.String itemName, Expression attributeExpression)
public void addSum(java.lang.String itemName)
public void addSum(java.lang.String itemName, Expression attributeExpression)
public void addVariance(java.lang.String itemName)
public void addVariance(java.lang.String itemName, Expression attributeExpression)
public void asReadAllQuery()
public void asReadObjectQuery()
public void asReportQuery()
public void bindAllParameters()
public void cacheStatement()
public void cascadeAllParts()
public void cascadePrivateParts()
public void checkCacheByExactPrimaryKey()
#setCacheUsage(int)
public void checkCacheByPrimaryKey()
#setCacheUsage(int)
public void checkCacheOnly()
#setCacheUsage(int)
public void checkCacheThenDatabase()
#setCacheUsage(int)
public void close(java.lang.Object queryResult)
close
in interface javax.jdo.Query
queryResult
- the result of execute(...) on this Query instance.public void closeAll()
closeAll
in interface javax.jdo.Query
public void conformResultsInUnitOfWork()
#setCacheUsage(int)
public void dontAcquireLocks()
public void dontBindAllParameters()
public void dontCacheStatement()
public void dontCascadeParts()
public void dontCheckCache()
public void dontMaintainCache()
public void dontRefreshIdentityMapResult()
public void dontRefreshRemoteIdentityMapResult()
public void dontUseDistinct()
public java.lang.Object executeWithMap(java.util.Map arg1)
executeWithMap
in interface javax.jdo.Query
executeWithArray(Object[] parameters)
public oracle.toplink.internal.databaseaccess.DatabaseCall getCall()
prepareCall(Session, DatabaseRow);
public java.lang.Object getExampleObject()
public ExpressionBuilder getExpressionBuilder()
public DatabaseQuery getQuery()
public int getQueryTimeout()
public ReadAllQuery getReadAllQuery()
public ReadObjectQuery getReadObjectQuery()
public java.lang.Class getReferenceClass()
public ReportQuery getReportQuery()
public Expression getSelectionCriteria()
public void maintainCache()
public void refreshIdentityMapResult()
public void setCall(Call call)
public void setCandidates(java.util.Collection arg1)
setCandidates
in interface javax.jdo.Query
public void setEJBQLString(java.lang.String ejbqlString)
public void setFilter(Expression selectionCriteria)
public void setQuery(DatabaseQuery newQuery)
public void setQueryByExampleFilter(java.lang.Object exampleObject)
public void setQueryByExamplePolicy(QueryByExamplePolicy newPolicy)
public void setQueryTimeout(int queryTimeout)
public void setShouldBindAllParameters(boolean shouldBindAllParameters)
public void setShouldCacheStatement(boolean shouldCacheStatement)
public void setShouldMaintainCache(boolean shouldMaintainCache)
public void setShouldRefreshIdentityMapResult(boolean shouldRefreshIdentityMapResult)
public void setSQLString(java.lang.String sqlString)
public boolean shouldBindAllParameters()
public boolean shouldCacheStatement()
public boolean shouldCascadeAllParts()
public boolean shouldCascadeParts()
public boolean shouldCascadePrivateParts()
public boolean shouldMaintainCache()
public boolean shouldRefreshIdentityMapResult()
public void useCollectionClass(java.lang.Class concreteClass)
jdk1.2.x: The container class must implement (directly or indirectly) the Collection interface.
jdk1.1.x: The container class must be a subclass of Vector.
public void useCursoredStream()
public void useCursoredStream(int initialReadSize, int pageSize)
initialReadSize
- the initial number of objects to readpageSize
- the number of objects to read when more objects are needed from the databasepublic void useCursoredStream(int initialReadSize, int pageSize, ValueReadQuery sizeQuery)
initialReadSize
- the initial number of objects to readpageSize
- the number of objects to read when more objects are needed from the databasesizeQuery
- a query that will return the size of the result set; this must be set if an expression is not used (i.e. custom SQL)public void useDistinct()
public void useMapClass(java.lang.Class concreteClass, java.lang.String methodName)
jdk1.2.x: The container class must implement (directly or indirectly) the Map interface.
jdk1.1.x: The container class must be a subclass of Hashtable.
The referenceClass must set before calling this method.
public void useScrollableCursor()
public void useScrollableCursor(int pageSize)
pageSize
- the number of elements to be read into a the cursor when more elements are needed from the database.
|
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |