Oracle Fusion Middleware Java API Reference for Oracle TopLink (Deprecated)
11g Release 1 (11.1.1)

B32476-04

oracle.toplink.queryframework
Class ReadQuery

java.lang.Object
  extended by oracle.toplink.queryframework.DatabaseQuery
      extended by oracle.toplink.queryframework.ReadQuery
All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable, oracle.toplink.internal.helper.FalseUndefinedTrue
Direct Known Subclasses:
DataReadQuery, ObjectBuildingQuery

public abstract class ReadQuery
extends DatabaseQuery

Purpose: Abstract class for all read queries.

Responsibilities:

Since:
TOPLink/Java 1.0
See Also:
Serialized Form

Field Summary
 
Fields inherited from class oracle.toplink.queryframework.DatabaseQuery
CascadeAggregateDelete, CascadeAllParts, CascadeByMapping, CascadeDependentParts, CascadePrivateParts, NoCascading
 
Constructor Summary
ReadQuery()
          Initialize the state of the query
 
Method Summary
 void cacheQueryResults()
          ADVANCED: This method will instruct the query to cache the results returned by its next execution.
 void clearQueryResults()
          Deprecated.  
 void clearQueryResults(oracle.toplink.internal.sessions.AbstractSession session)
          Clears the current cached results, the next execution with read from the database.
 void doNotCacheQueryResults()
          ADVANCED: This method will instruct the query not to cache results.
 int getFetchSize()
          Return the fetchSize setting that this query will set on the JDBC Statement NB - a value of zero means that no call to statement.setFetchSize() will be made.
 int getFirstResult()
          Return the value that will be set for the firstResult in the returned result set
 int getMaxRows()
          Return the limit for the maximum number of rows that any ResultSet can contain to the given number.
 QueryResultsCachePolicy getQueryResultsCachePolicy()
          Return the QueryResultsCachePolicy for this query.
 boolean isReadQuery()
          Return if this is a read query.
 void setFetchSize(int fetchSize)
          Set the fetchSize setting that this query will set on the JDBC Statement NB - a value of zero means that no call to statement.setFetchSize() will be made.
 void setFirstResult(int firstResult)
          Used to set the first result in any result set that is returned for this query.
 void setMaxRows(int maxRows)
          Used to set the limit for the maximum number of rows that any ResultSet can contain to the given number.
 void setQueryResultsCachePolicy(QueryResultsCachePolicy policy)
          Set the QueryResultsCachePolicy.
 void setShouldCacheQueryResults(boolean shouldCacheQueryResults)
          Deprecated. since 10.1.3, replaced by setQueryResultsCachingPolicy(QueryResultsCachePolicy)
 boolean shouldCacheQueryResults()
          Return if the query should cache the results of the next execution or not.
 
Methods inherited from class oracle.toplink.queryframework.DatabaseQuery
addArgument, addArgument, addArgument, addArgumentValue, addArgumentValues, addCall, addStatement, bindAllParameters, cacheStatement, cascadeAllParts, cascadeByMapping, cascadePrivateParts, dontBindAllParameters, dontCacheStatement, dontCascadeParts, dontMaintainCache, getCall, getCalls, getDatasourceCall, getDatasourceCalls, getEJBQLString, getFlushOnExecute, getHintString, getJPQLString, getName, getQueryTimeout, getRedirector, getReferenceClass, getSelectionCriteria, getSessionName, getSQLStatement, getSQLString, getSQLStrings, getTranslatedSQLString, getTranslatedSQLStrings, hasSessionName, ignoreBindAllParameters, ignoreCacheStatement, isCallQuery, isDataModifyQuery, isDataReadQuery, isDeleteAllQuery, isDeleteObjectQuery, isDirectReadQuery, isExpressionQuery, isInsertObjectQuery, isModifyAllQuery, isModifyQuery, isNativeConnectionRequired, isObjectBuildingQuery, isObjectLevelModifyQuery, isObjectLevelReadQuery, isReadAllQuery, isReadObjectQuery, isReportQuery, isSQLCallQuery, isUpdateAllQuery, isUpdateObjectQuery, isValueReadQuery, isWriteObjectQuery, maintainCache, prepareCall, setCall, setDatasourceCall, setEJBQLString, setFlushOnExecute, setHintString, setIsNativeConnectionRequired, setJPQLString, setName, setQueryTimeout, setRedirector, setSelectionCriteria, setSessionName, setShouldBindAllParameters, setShouldCacheStatement, setShouldMaintainCache, setShouldPrepare, setShouldUseWrapperPolicy, setSQLStatement, setSQLString, shouldBindAllParameters, shouldCacheStatement, shouldCascadeAllParts, shouldCascadeByMapping, shouldCascadeParts, shouldCascadePrivateParts, shouldIgnoreBindAllParameters, shouldIgnoreCacheStatement, shouldMaintainCache, shouldPrepare, shouldUseWrapperPolicy, toString
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ReadQuery

public ReadQuery()
Initialize the state of the query

Method Detail

cacheQueryResults

public void cacheQueryResults()
ADVANCED:

This method will instruct the query to cache the results returned by its next execution. All subsequent executions of this query will return this cached result set even if new query parameters are specified. This method provides a performance enhancement for queries known to always return the same result set. Oracle recommends that you use this method only for such queries.

To disable this behaviour, call doNotCacheQueryResults() or setQueryResultsCachePolicy(oracle.toplink.queryframework.QueryResultsCachePolicy) passing in null.


clearQueryResults

public void clearQueryResults()
Deprecated. 

Clears the current cached results, the next execution with read from the database.

Since:
10.1.3
See Also:
#clearQueryResults(Session)

clearQueryResults

public void clearQueryResults(oracle.toplink.internal.sessions.AbstractSession session)
Clears the current cached results, the next execution with read from the database.


doNotCacheQueryResults

public void doNotCacheQueryResults()
ADVANCED:

This method will instruct the query not to cache results. All subsequent executions return result sets according to the current configuration of query parameters. After calling this method, any previously cached result set will be discarded the next time the query is executed.

This is equivalent to calling setShouldCacheQueryResults(boolean) passing in a boolean false.

To enable this behaviour, call cacheQueryResults() or setQueryResultsCachePolicy(oracle.toplink.queryframework.QueryResultsCachePolicy) passing in a valid QueryResultsCachePolicy.

Note: If this method is called on a query that initially cached query results, clearQueryResults(Session) should also be called. Otherwise, the results of this query will remain in the cache and cause extra memory use


getQueryResultsCachePolicy

public QueryResultsCachePolicy getQueryResultsCachePolicy()
Return the QueryResultsCachePolicy for this query.

See Also:
QueryResultsCachePolicy

getFirstResult

public int getFirstResult()
Return the value that will be set for the firstResult in the returned result set


getMaxRows

public int getMaxRows()
Return the limit for the maximum number of rows that any ResultSet can contain to the given number.


getFetchSize

public int getFetchSize()
Return the fetchSize setting that this query will set on the JDBC Statement NB - a value of zero means that no call to statement.setFetchSize() will be made.


isReadQuery

public boolean isReadQuery()
Return if this is a read query.

Overrides:
isReadQuery in class DatabaseQuery

setQueryResultsCachePolicy

public void setQueryResultsCachePolicy(QueryResultsCachePolicy policy)
Set the QueryResultsCachePolicy.

See Also:
QueryResultsCachePolicy

setFirstResult

public void setFirstResult(int firstResult)
Used to set the first result in any result set that is returned for this query. This method should only be set once per query. To change the firstReslt use another query. This method will call the absolute method on the JDBC result set to move the initial row used by TopLink. Note: The set of results returned from the database will still include the results before the first result. TopLink will just not use them for object building.


setMaxRows

public void setMaxRows(int maxRows)
Used to set the limit for the maximum number of rows that any ResultSet can contain to the given number. This method should only be set once per query. To change the max rows use another query. This method limits the number of candidate results returned to TopLink that can be used to build objects


setFetchSize

public void setFetchSize(int fetchSize)
Set the fetchSize setting that this query will set on the JDBC Statement NB - a value of zero means that no call to statement.setFetchSize() will be made.


setShouldCacheQueryResults

public void setShouldCacheQueryResults(boolean shouldCacheQueryResults)
Deprecated. since 10.1.3, replaced by setQueryResultsCachingPolicy(QueryResultsCachePolicy)

ADVANCED: Use this method to configure whether or not the query should cache the results returned by its next execution.

When shouldCacheQueryResults is true, this method instructs the query to cache the results returned by its next execution. All subsequent executions of this query will return this cached result set even if you specify new query parameters. This provides a performance enhancement for queries known to always return the same result set. Oracle recommends that you set this parameter to true only for such queries.

When shouldCacheQueryResults is false, this method instructs the query not to cache results. All subsequent executions of this query return result sets according to the current configuration of query parameters. After setting this parameter to false, any previously cached result set will be discarded the next time the query is executed.

Parameters:
shouldCacheQueryResults - boolean true, the query caches results of its next execution; false, the query does not cache results Note: If calling setShouldCacheQueryResults(false) on a query that currently caches it's results, clearQueryResults(Session) should also be called This will avoid using extra memory to store query results of a query that no longer caches.
See Also:
setQueryResultsCachePolicy(QueryResultsCachePolicy)

shouldCacheQueryResults

public boolean shouldCacheQueryResults()
Return if the query should cache the results of the next execution or not.


Copyright © 1998, 2012, Oracle. All Rights Reserved.