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 ReadObjectQuery

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

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

public class ReadObjectQuery
extends ObjectLevelReadQuery

Purpose: Concrete class for all read queries involving a single object.

Responsibilities: Return a single object for the query. Implements the inheritance feature when dealing with abstract descriptors.

Since:
  TOPLink/Java 1.0
See Also:
  Serialized Form

Field Summary

Fields inherited from class oracle.toplink.queryframework.ObjectLevelReadQuery
`CheckCacheByExactPrimaryKey, CheckCacheByPrimaryKey, CheckCacheOnly, CheckCacheThenDatabase, ConformResultsInUnitOfWork, DEFAULT_LOCK_MODE, DoNotCheckCache, DONT_USE_DISTINCT, LOCK, LOCK_NOWAIT, NO_LOCK, UNCOMPUTED_DISTINCT, USE_DISTINCT, UseDescriptorSetting`

Fields inherited from class oracle.toplink.queryframework.DatabaseQuery
`CascadeAggregateDelete, CascadeAllParts, CascadeByMapping, CascadeDependentParts, CascadePrivateParts, NoCascading`

Constructor Summary
`ReadObjectQuery()` PUBLIC: Return a new read object query.
`ReadObjectQuery(Call call)` PUBLIC: Return a new read object query.
`ReadObjectQuery(java.lang.Class classToRead)` PUBLIC: Return a new read object query.
`ReadObjectQuery(java.lang.Class classToRead, Call call)` PUBLIC: Return a new read object query.
`ReadObjectQuery(java.lang.Class classToRead, Expression selectionCriteria)` PUBLIC: Return a new read object query for the class and the selection criteria.
`ReadObjectQuery(java.lang.Class classToRead, ExpressionBuilder builder)` PUBLIC: Return a new read object query for the class.
`ReadObjectQuery(ExpressionBuilder builder)` PUBLIC: The expression builder should be provide on creation to ensure only one is used.
`ReadObjectQuery(java.lang.Object objectToRead)` PUBLIC: Return a query to read the object with the same primary key as the provided object.
`ReadObjectQuery(java.lang.Object exampleObject, QueryByExamplePolicy policy)` PUBLIC: Return a query by example query to find an object matching the attributes of the example object.

Method Summary
`void` | `checkCache()` Deprecated. replaced by checkCacheByPrimaryKey
`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` | `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` | `dontLoadResultIntoSelectionObject()` PUBLIC: Do not refesh/load into the selection object, this is the default.
`java.util.Vector` | `getSelectionKey()` PUBLIC: The primary key can be specified if used instead of an expression or selection object.
`java.lang.Object` | `getSelectionObject()` PUBLIC: Return the selection object of the query.
`boolean` | `isReadObjectQuery()` PUBLIC: Return if this is a read object query.
`void` | `loadResultIntoSelectionObject()` PUBLIC: Allow for the selection object of the query to be refreshed or put into the TopLink cache.
`void` | `setCheckCache(boolean checkCache)` Deprecated. replaced by setCacheUsage
`void` | `setSelectionKey(java.util.Vector selectionKey)` PUBLIC: The primary key can be specified if used instead of an expression or selection object.
`void` | `setSelectionObject(java.lang.Object selectionObject)` PUBLIC: Used to set the where clause of the query.
`void` | `setShouldLoadResultIntoSelectionObject(boolean shouldLoadResultIntoSelectionObject)` PUBLIC: Allow for the selection object of the query to be refreshed or put into the TopLink cache.
`void` | `setSingletonSelectionKey(java.lang.Object selectionKey)` PUBLIC: The primary key can be specified if used instead of an expression or selection object.
`boolean` | `shouldCheckCache()` PUBLIC: Return if the cache should be checked.
`boolean` | `shouldCheckCacheByExactPrimaryKey()` PUBLIC: Return if cache should be checked.
`boolean` | `shouldCheckCacheByPrimaryKey()` PUBLIC: Return if cache should be checked.
`boolean` | `shouldCheckCacheThenDatabase()` PUBLIC: Return if cache should be checked.
`boolean` | `shouldLoadResultIntoSelectionObject()` PUBLIC: return true if the result should be loaded into the passed in selection Object

Methods inherited from class oracle.toplink.queryframework.ObjectLevelReadQuery
`acquireLocks, acquireLocksWithoutWaiting, addJoinedAttribute, addJoinedAttribute, addPartialAttribute, addPartialAttribute, checkCacheOnly, conformResultsInUnitOfWork, dontAcquireLocks, dontCheckCache, dontRefreshIdentityMapResult, dontRefreshRemoteIdentityMapResult, dontUseDistinct, executeDatabaseQuery, getAsOfClause, getCacheUsage, getDistinctState, getExampleObject, getExpressionBuilder, getFetchGroup, getFetchGroupName, getInMemoryQueryIndirectionPolicy, getLockMode, getQueryByExamplePolicy, getReferenceClass, hasAsOfClause, isLockQuery, isLockQuery, isObjectLevelReadQuery, refreshIdentityMapResult, refreshRemoteIdentityMapResult, resetDistinct, setAsOfClause, setCacheUsage, setDistinctState, setEJBQLString, setExampleObject, setFetchGroup, setFetchGroupName, setInMemoryQueryIndirectionPolicy, setLockMode, setQueryByExamplePolicy, setReferenceClass, setSelectionCriteria, setShouldProcessResultsInUnitOfWork, setShouldRefreshIdentityMapResult, setShouldRefreshRemoteIdentityMapResult, setShouldUseDefaultFetchGroup, setShouldUseExclusiveConnection, shouldCheckCacheOnly, shouldCheckDescriptorForCacheUsage, shouldConformResultsInUnitOfWork, shouldProcessResultsInUnitOfWork, shouldRefreshIdentityMapResult, shouldRefreshRemoteIdentityMapResult, shouldUseDefaultFetchGroup, shouldUseExclusiveConnection, toString, useDistinct`

Methods inherited from class oracle.toplink.queryframework.ReadQuery
`cacheQueryResults, clearQueryResults, clearQueryResults, doNotCacheQueryResults, getFetchSize, getFirstResult, getMaxRows, getQueryResultsCachePolicy, isReadQuery, setFetchSize, setFirstResult, setMaxRows, setQueryResultsCachePolicy, setShouldCacheQueryResults, shouldCacheQueryResults`

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, getSelectionCriteria, getSessionName, getSQLStatement, getSQLString, getSQLStrings, getTranslatedSQLString, getTranslatedSQLStrings, hasSessionName, ignoreBindAllParameters, ignoreCacheStatement, isCallQuery, isDataModifyQuery, isDataReadQuery, isDeleteObjectQuery, isExpressionQuery, isInsertObjectQuery, isModifyQuery, isObjectLevelModifyQuery, isReadAllQuery, isReportQuery, isSQLCallQuery, isUpdateAllQuery, isUpdateObjectQuery, isWriteObjectQuery, maintainCache, prepareCall, setCall, setDatasourceCall, setHintString, setName, setQueryTimeout, setRedirector, setSessionName, setShouldBindAllParameters, setShouldCacheStatement, setShouldMaintainCache, setShouldPrepare, setShouldUseWrapperPolicy, setSQLStatement, setSQLString, shouldBindAllParameters, shouldCacheStatement, shouldCascadeAllParts, shouldCascadeByMapping, shouldCascadeParts, shouldCascadePrivateParts, shouldIgnoreBindAllParameters, shouldIgnoreCacheStatement, shouldMaintainCache, shouldPrepare, shouldUseWrapperPolicy`

Methods inherited from class java.lang.Object
`equals, getClass, hashCode, notify, notifyAll, wait, wait, wait`

Constructor Detail

### ReadObjectQuery

    public ReadObjectQuery()

  PUBLIC: Return a new read object query. A reference class must be specified before execution. It is better to provide the class and expression builder on construction to esnure a single expression builder is used. If no selection criteria is specified this will reads the first object found in the database.

### ReadObjectQuery

    public ReadObjectQuery(java.lang.Class classToRead)

  PUBLIC: Return a new read object query. By default, the query has no selection criteria. Executing this query without selection criteria will always result in a database access to read the first instance of the specified Class found in the database. This is true no matter how cache usage is configured and even if an instance of the specified Class exists in the cache. Executing a query with selection criteria allows you to avoid a database access if the selected instance is in the cache. For this reason, you may whish to use a ReadObjectQuery constructor that takes selection criteria, such as: `ReadObjectQuery(Class, Call)`, `ReadObjectQuery(Class, Expression)`, `ReadObjectQuery(Class, ExpressionBuilder)`, `ReadObjectQuery(ExpressionBuilder)`, `ReadObjectQuery(Object)`, or `ReadObjectQuery(Object, QueryByExamplePolicy)`.

### ReadObjectQuery

    public ReadObjectQuery(java.lang.Class classToRead,
                           Expression selectionCriteria)

  PUBLIC: Return a new read object query for the class and the selection criteria.

### ReadObjectQuery

    public ReadObjectQuery(java.lang.Class classToRead,
                           ExpressionBuilder builder)

  PUBLIC: Return a new read object query for the class. The expression builder must be used for all associated expressions used with the query.

### ReadObjectQuery

    public ReadObjectQuery(java.lang.Class classToRead,
                           Call call)

  PUBLIC: Return a new read object query. The call represents a database interaction such as SQL, Stored Procedure.

### ReadObjectQuery

    public ReadObjectQuery(Call call)

  PUBLIC: Return a new read object query. The call represents a database interaction such as SQL, Stored Procedure.

### ReadObjectQuery

    public ReadObjectQuery(java.lang.Object objectToRead)

  PUBLIC: Return a query to read the object with the same primary key as the provided object. Note: This is not a query by example object, only the primary key will be used for the selection criteria.

### ReadObjectQuery

    public ReadObjectQuery(java.lang.Object exampleObject,
                           QueryByExamplePolicy policy)

  PUBLIC: Return a query by example query to find an object matching the attributes of the example object.

### ReadObjectQuery

    public ReadObjectQuery(ExpressionBuilder builder)

  PUBLIC: The expression builder should be provide on creation to ensure only one is used.

Method Detail

### checkCache

    public void checkCache()

  Deprecated. replaced by checkCacheByPrimaryKey
  OBSOLETE: This can be used to explicitly disable the cache hit. The cache hit may not be desired in some cases, such as stored procedures that accept the primary key but do not query on it.

### checkCacheByExactPrimaryKey

    public void checkCacheByExactPrimaryKey()

  PUBLIC: The cache will be checked only if the query contains exactly the primary key. Queries can be configured to use the cache at several levels. Other caching option are available.
  See Also:
    `ObjectLevelReadQuery.setCacheUsage(int)`

### checkCacheByPrimaryKey

    public void checkCacheByPrimaryKey()

  PUBLIC: This is the default, the cache will be checked only if the query contains the primary key. Queries can be configured to use the cache at several levels. Other caching option are available.
  See Also:
    `ObjectLevelReadQuery.setCacheUsage(int)`

### checkCacheThenDatabase

    public 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. Queries can be configured to use the cache at several levels. Other caching option are available.
  See Also:
    `ObjectLevelReadQuery.setCacheUsage(int)`

### dontLoadResultIntoSelectionObject

    public void dontLoadResultIntoSelectionObject()

  PUBLIC: Do not refesh/load into the selection object, this is the default. This property allows for the selection object of the query to be refreshed or put into the TopLink cache. By default on a read or refresh the object in the cache is refreshed and returned or a new object is built from the database, in some cases such as EJB BMP it is desirable to refresh or load into the object passed into the read object query.

  Note: This forces the selection object into the cache a replaces any existing object that may already be there, this is a strict violation of object identity and other objects can still be refering to the old object.

### getSelectionKey

    public java.util.Vector getSelectionKey()

  PUBLIC: The primary key can be specified if used instead of an expression or selection object. If composite the primary must be in the same order as defined in the descriptor.

### getSelectionObject

    public java.lang.Object getSelectionObject()

  PUBLIC: Return the selection object of the query. This can be used instead of a where clause expression for single object primary key queries. The selection object given should have a primary key defined, this primary key will be used to query the database instance of the same object. This is a basic form of query by example where only the primary key is required, it can be used for simple query forms, or testing.

### isReadObjectQuery

    public boolean isReadObjectQuery()

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

### loadResultIntoSelectionObject

    public void loadResultIntoSelectionObject()

  PUBLIC: Allow for the selection object of the query to be refreshed or put into the TopLink cache. By default on a read or refresh the object in the cache is refreshed and returned or a new object is built from the database, in some cases such as EJB BMP it is desirable to refresh or load into the object passed into the read object query.

  Note: This forces the selection object into the cache a replaces any existing object that may already be there, this is a strict violation of object identity and other objects can still be refering to the old object.

### setCheckCache

    public void setCheckCache(boolean checkCache)

  Deprecated. replaced by setCacheUsage
  OBSOLETE: This can be used to explicitly disable the cache hit. The cache hit may not be desired in some cases, such as stored procedures that accept the primary key but do not query on it.

### setSelectionKey

    public void setSelectionKey(java.util.Vector selectionKey)

  PUBLIC: The primary key can be specified if used instead of an expression or selection object. If composite the primary must be in the same order as defined in the descriptor.

### setSelectionObject

    public void setSelectionObject(java.lang.Object selectionObject)

  PUBLIC: Used to set the where clause of the query. This can be used instead of a where clause expression for single object primary key queries. The selection object given should have a primary key defined, this primary key will be used to query the database instance of the same object. This is a basic form of query by example where only the primary key is required, it can be used for simple query forms, or testing.

### setShouldLoadResultIntoSelectionObject

    public void setShouldLoadResultIntoSelectionObject(boolean shouldLoadResultIntoSelectionObject)

  PUBLIC: Allow for the selection object of the query to be refreshed or put into the TopLink cache. By default on a read or refresh the object in the cache is refreshed and returned or a new object is built from the database, in some cases such as EJB BMP it is desirable to refresh or load into the object passed into the read object query.

  Note: This forces the selection object into the cache a replaces any existing object that may already be there, this is a strict violation of object identity and other objects can still be refering to the old object.

### setSingletonSelectionKey

    public void setSingletonSelectionKey(java.lang.Object selectionKey)

  PUBLIC: The primary key can be specified if used instead of an expression or selection object.

### shouldCheckCache

    public boolean shouldCheckCache()

  PUBLIC: Return if the cache should be checked.

### shouldCheckCacheByExactPrimaryKey

    public boolean shouldCheckCacheByExactPrimaryKey()

  PUBLIC: Return if cache should be checked.

### shouldCheckCacheByPrimaryKey

    public boolean shouldCheckCacheByPrimaryKey()

  PUBLIC: Return if cache should be checked.

### shouldCheckCacheThenDatabase

    public boolean shouldCheckCacheThenDatabase()

  PUBLIC: Return if cache should be checked.

### shouldLoadResultIntoSelectionObject

    public boolean shouldLoadResultIntoSelectionObject()

  PUBLIC: return true if the result should be loaded into the passed in selection Object

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