Oracle Application Server TopLink API Reference
10g Release 2 (10.1.2)

B15903-01


oracle.toplink.queryframework
Class ReadQuery

java.lang.Object
  extended byoracle.toplink.queryframework.DatabaseQuery
      extended byoracle.toplink.queryframework.ReadQuery

All Implemented Interfaces:
java.lang.Cloneable, oracle.toplink.internal.helper.FalseUndefinedTrue, java.io.Serializable
Direct Known Subclasses:
DataReadQuery, ObjectLevelReadQuery

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, CascadeDependentParts, CascadePrivateParts, NoCascading, QUERY_PREPARE

Constructor Summary
ReadQuery()
PUBLIC: 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()
PUBLIC: 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 getMaxRows()
PUBLIC: Return the limit for the maximum number of rows that any ResultSet can contain to the given number.
boolean isReadQuery()
PUBLIC: Return if this is a read query.
void setMaxRows(int maxRows)
PUBLIC: Used to set the limit for the maximum number of rows that any ResultSet can contain to the given number.
void setShouldCacheQueryResults(boolean shouldCacheQueryResults)
ADVANCED: Use this method to configure whether or not the query should cache the results returned by its next execution.
boolean shouldCacheQueryResults()
PUBLIC: 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, cascadePrivateParts, dontBindAllParameters, dontCacheStatement, dontCascadeParts, dontMaintainCache, getCall, getEJBQLString, getHintString, getName, getQueryTimeout, getRedirector, getReferenceClass, getSelectionCriteria, getSessionName, getSQLStatement, getSQLString, getTranslatedSQLString, hasSessionName, ignoreBindAllParameters, ignoreCacheStatement, isCallQuery, isDataModifyQuery, isDataReadQuery, isDeleteObjectQuery, isExpressionQuery, isModifyQuery, isObjectLevelModifyQuery, isObjectLevelReadQuery, isReadAllQuery, isReadObjectQuery, isReportQuery, isSQLCallQuery, isWriteObjectQuery, maintainCache, prepareCall, setCall, setEJBQLString, setHintString, setName, setQueryTimeout, setRedirector, setSelectionCriteria, setSessionName, setShouldBindAllParameters, setShouldCacheStatement, setShouldMaintainCache, setShouldPrepare, setShouldUseWrapperPolicy, setSQLStatement, setSQLString, shouldBindAllParameters, shouldCacheStatement, shouldCascadeAllParts, 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()
PUBLIC: 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 setShouldCacheQueryResults(boolean) passing in a boolean false.


clearQueryResults

public void clearQueryResults()
PUBLIC: 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 setShouldCacheQueryResults(boolean) passing in a boolean true.


getMaxRows

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

isReadQuery

public boolean isReadQuery()
PUBLIC: Return if this is a read query.
Overrides:
isReadQuery in class DatabaseQuery

setMaxRows

public void setMaxRows(int maxRows)
PUBLIC: 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.

setShouldCacheQueryResults

public void setShouldCacheQueryResults(boolean shouldCacheQueryResults)
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

shouldCacheQueryResults

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

Copyright © 1998, 2005 Oracle Corporation. All Rights Reserved.