Overview | Package | Class | Tree | Deprecated | Index | Help
| Oracle TopLink API Reference 10g Release 3 (10.1.3) B13698-01
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## oracle.toplink.queryframework
Class ReadQuery

`java.lang.Object
oracle.toplink.queryframework.DatabaseQuery
oracle.toplink.queryframework.ReadQuery`

All Implemented Interfaces:
  java.lang.Cloneable, java.io.Serializable

Direct Known Subclasses:
  DataReadQuery, ObjectLevelReadQuery

public abstract class ReadQuery
extends DatabaseQuery

Purpose: Abstract class for all read queries.

Responsibilities:

- Caches result of query if flag is set.

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()` 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()` Deprecated.
`void` | `clearQueryResults(Session session)` 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` | `getFetchSize()` PUBLIC: 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()` PUBLIC: Return the value that will be set for the firstResult in the returned result set
`int` | `getMaxRows()` PUBLIC: Return the limit for the maximum number of rows that any ResultSet can contain to the given number.
`QueryResultsCachePolicy` | `getQueryResultsCachePolicy()` PUBLIC: Return the QueryResultsCachePolicy for this query
`boolean` | `isReadQuery()` PUBLIC: Return if this is a read query.
`void` | `setFetchSize(int fetchSize)` PUBLIC: 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)` PUBLIC: Used to set the first result in any result set that is returned for this 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` | `setQueryResultsCachePolicy(QueryResultsCachePolicy policy)` Set the QueryResultsCachePolicy.
`void` | `setShouldCacheQueryResults(boolean shouldCacheQueryResults)` Deprecated.
`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, cascadeByMapping, cascadePrivateParts, dontBindAllParameters, dontCacheStatement, dontCascadeParts, dontMaintainCache, getCall, getCalls, getDatasourceCall, getDatasourceCalls, getEJBQLString, getHintString, getName, getQueryTimeout, getRedirector, getReferenceClass, getSelectionCriteria, getSessionName, getSQLStatement, getSQLString, getSQLStrings, getTranslatedSQLString, getTranslatedSQLStrings, hasSessionName, ignoreBindAllParameters, ignoreCacheStatement, isCallQuery, isDataModifyQuery, isDataReadQuery, isDeleteObjectQuery, isExpressionQuery, isInsertObjectQuery, isModifyQuery, isObjectLevelModifyQuery, isObjectLevelReadQuery, isReadAllQuery, isReadObjectQuery, isReportQuery, isSQLCallQuery, isUpdateAllQuery, isUpdateObjectQuery, isWriteObjectQuery, maintainCache, prepareCall, setCall, setDatasourceCall, setEJBQLString, setHintString, 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()

  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 `setQueryResultsCachePolicy(oracle.toplink.queryframework.QueryResultsCachePolicy)` passing in null.

### clearQueryResults

    public void clearQueryResults()

  Deprecated.
  PUBLIC: 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(Session session)

  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 `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()

  PUBLIC: Return the QueryResultsCachePolicy for this query
  See Also:
    `#oracle.toplink.queryframework.QueryResultsCachePolicy`

### getFirstResult

    public int getFirstResult()

  PUBLIC: Return the value that will be set for the firstResult in the returned result set

### getMaxRows

    public int getMaxRows()

  PUBLIC: Return the limit for the maximum number of rows that any ResultSet can contain to the given number.

### getFetchSize

    public int getFetchSize()

  PUBLIC: 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()

  PUBLIC: Return if this is a read query.
  Overrides:
    `isReadQuery` in class `DatabaseQuery`

### setQueryResultsCachePolicy

    public void setQueryResultsCachePolicy(QueryResultsCachePolicy policy)

  Set the QueryResultsCachePolicy.
  See Also:
    `#oracle.toplink.queryframework.QueryResultsCachePolicy`

### setFirstResult

    public void setFirstResult(int firstResult)

  PUBLIC: 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)

  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. This method limits the number of candidate results returned to TopLink that can be used to build objects

### setFetchSize

    public void setFetchSize(int fetchSize)

  PUBLIC: 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.
  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.
  Since:
    10.1.3
  See Also:
    `#setQueryResultsCachingPolicy(QueryResultsCachePolicy)`

### shouldCacheQueryResults

    public boolean shouldCacheQueryResults()

  PUBLIC: Return if the query should cache the results of the next execution or not.

Overview | Package | Class | Tree | Deprecated | Index | Help
| Copyright © 1998, 2006, Oracle. All Rights Reserved.
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD