|
Oracle Fusion Middleware Java API Reference for Oracle TopLink 11g Release 1 (11.1.1) B32476-02 |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object
oracle.toplink.queryframework.DatabaseQuery
oracle.toplink.queryframework.ReadQuery
public abstract class ReadQuery
Purpose: Abstract class for all read queries.
Responsibilities:
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 java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public ReadQuery()
Method Detail |
---|
public void cacheQueryResults()
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.
public void clearQueryResults()
#clearQueryResults(Session)
public void clearQueryResults(oracle.toplink.internal.sessions.AbstractSession session)
public void doNotCacheQueryResults()
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.
public QueryResultsCachePolicy getQueryResultsCachePolicy()
QueryResultsCachePolicy
public int getFirstResult()
public int getMaxRows()
public int getFetchSize()
public boolean isReadQuery()
isReadQuery
in class DatabaseQuery
public void setQueryResultsCachePolicy(QueryResultsCachePolicy policy)
QueryResultsCachePolicy
public void setFirstResult(int firstResult)
public void setMaxRows(int maxRows)
public void setFetchSize(int fetchSize)
public void setShouldCacheQueryResults(boolean shouldCacheQueryResults)
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.
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.setQueryResultsCachePolicy(QueryResultsCachePolicy)
public boolean shouldCacheQueryResults()
|
|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |