Skip navigation links

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

B32476-02


oracle.toplink.queryframework
Class ObjectBuildingQuery

java.lang.Object
  extended by oracle.toplink.queryframework.DatabaseQuery
      extended by oracle.toplink.queryframework.ReadQuery
          extended by oracle.toplink.queryframework.ObjectBuildingQuery

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

public abstract class ObjectBuildingQuery
extends ReadQuery

Purpose: Abstract class for all read queries that build objects and potentially manipulate the TopLink cache.

Description: Contains common behavior for all read queries building objects.

Since:
TopLink Essentials
See Also:
Serialized Form

Field Summary
static short DEFAULT_LOCK_MODE
           
static short LOCK
           
static short LOCK_NOWAIT
           
static short NO_LOCK
           

 

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

 

Method Summary
 void dontRefreshIdentityMapResult()
          When unset means perform read normally and dont do refresh.
 void dontRefreshRemoteIdentityMapResult()
          When unset means perform read normally and dont do refresh.
 FetchGroup getFetchGroup()
          Return the fetch group set in the query.
 short getLockMode()
          Return the current locking mode.
 java.lang.Class getReferenceClass()
          Return the reference class of the query.
 boolean isLockQuery()
          Answers if the query lock mode is known to be LOCK or LOCK_NOWAIT.
 boolean isObjectBuildingQuery()
          Return if this is an object building query.
 void refreshIdentityMapResult()
          Refresh the attributes of the object(s) resulting from the query.
 void refreshRemoteIdentityMapResult()
          Refresh the attributes of the object(s) resulting from the query.
 void setLockMode(short lockMode)
          Sets whether this is a pessimistically locking query.
 void setReferenceClass(java.lang.Class aClass)
          REQUIRED: Set the reference class for the query.
 void setShouldProcessResultsInUnitOfWork(boolean processResultsInUnitOfWork)
          ADVANCED: Used for CMP only.
 void setShouldRefreshIdentityMapResult(boolean shouldRefreshIdentityMapResult)
          Set if the attributes of the object(s) resulting from the query should be refreshed.
 void setShouldRefreshRemoteIdentityMapResult(boolean shouldRefreshIdentityMapResult)
          Set if the attributes of the object(s) resulting from the query should be refreshed.
 void setShouldUseExclusiveConnection(boolean shouldUseExclusiveConnection)
          ADVANCED: If the user has isolated data and specified that the client session should use an exclusive connection then by setting this condition to true TopLink will ensure that the query is executed through the exclusive connection.
 boolean shouldProcessResultsInUnitOfWork()
          ADVANCED: Used for CMP only.
 boolean shouldRefreshIdentityMapResult()
          Set to a boolean.
 boolean shouldRefreshRemoteIdentityMapResult()
          Set to a boolean.
 boolean shouldUseExclusiveConnection()
          ADVANCED: If the user has isolated data and specified that the client session should use an exclusive connection then by setting this condition to true TopLink will ensure that the query is executed through the exclusive connection.
 java.lang.String toString()
           

 

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, getFlushOnExecute, getHintString, getJPQLString, getName, getQueryTimeout, getRedirector, getSelectionCriteria, getSessionName, getSQLStatement, getSQLString, getSQLStrings, getTranslatedSQLString, getTranslatedSQLStrings, hasSessionName, ignoreBindAllParameters, ignoreCacheStatement, isCallQuery, isDataModifyQuery, isDataReadQuery, isDeleteAllQuery, isDeleteObjectQuery, isDirectReadQuery, isExpressionQuery, isInsertObjectQuery, isModifyAllQuery, isModifyQuery, isNativeConnectionRequired, 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

 

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

 

Field Detail

NO_LOCK

public static final short NO_LOCK
See Also:
Constant Field Values

LOCK

public static final short LOCK
See Also:
Constant Field Values

LOCK_NOWAIT

public static final short LOCK_NOWAIT
See Also:
Constant Field Values

DEFAULT_LOCK_MODE

public static final short DEFAULT_LOCK_MODE
See Also:
Constant Field Values

Method Detail

dontRefreshIdentityMapResult

public void dontRefreshIdentityMapResult()
When unset means perform read normally and dont do refresh.

dontRefreshRemoteIdentityMapResult

public void dontRefreshRemoteIdentityMapResult()
When unset means perform read normally and dont do refresh.

getFetchGroup

public FetchGroup getFetchGroup()
Return the fetch group set in the query. If a fetch group is not explicitly set in the query, default fetch group optionally defined in the decsiptor would be used, unless the user explicitly calls query.setShouldUseDefaultFetchGroup(false).

getLockMode

public short getLockMode()
Return the current locking mode.

getReferenceClass

public java.lang.Class getReferenceClass()
Return the reference class of the query.
Overrides:
getReferenceClass in class DatabaseQuery

isLockQuery

public boolean isLockQuery()
Answers if the query lock mode is known to be LOCK or LOCK_NOWAIT. In the case of DEFAULT_LOCK_MODE and the query reference class being a CMP entity bean, at execution time LOCK, LOCK_NOWAIT, or NO_LOCK will be decided.

If a single joined attribute was configured for pessimistic locking then this will return true (after first execution) as the SQL contained a FOR UPDATE OF clause.


isObjectBuildingQuery

public boolean isObjectBuildingQuery()
Return if this is an object building query.
Overrides:
isObjectBuildingQuery in class DatabaseQuery

refreshIdentityMapResult

public void refreshIdentityMapResult()
Refresh the attributes of the object(s) resulting from the query. If cascading is used the private parts of the objects will also be refreshed.

refreshRemoteIdentityMapResult

public void refreshRemoteIdentityMapResult()
Refresh the attributes of the object(s) resulting from the query. If cascading is used the private parts of the objects will also be refreshed.

setLockMode

public void setLockMode(short lockMode)
Sets whether this is a pessimistically locking query.

Fine Grained Locking: On execution the reference class and those of all joined attributes will be checked. If any of these have a PessimisticLockingPolicy set on their descriptor, they will be locked in a SELECT ... FOR UPDATE OF ... {NO WAIT}. Issues fewer locks and avoids setting the lock mode on each query.

Example:readAllQuery.setSelectionCriteria(employee.get("address").equal("Ottawa"));

See Also:
PessimisticLockingPolicy

setReferenceClass

public void setReferenceClass(java.lang.Class aClass)
REQUIRED: Set the reference class for the query.

setShouldRefreshIdentityMapResult

public void setShouldRefreshIdentityMapResult(boolean shouldRefreshIdentityMapResult)
Set if the attributes of the object(s) resulting from the query should be refreshed. If cascading is used the private parts of the objects will also be refreshed.

setShouldRefreshRemoteIdentityMapResult

public void setShouldRefreshRemoteIdentityMapResult(boolean shouldRefreshIdentityMapResult)
Set if the attributes of the object(s) resulting from the query should be refreshed. If cascading is used the private parts of the objects will also be refreshed.

setShouldUseExclusiveConnection

public void setShouldUseExclusiveConnection(boolean shouldUseExclusiveConnection)
ADVANCED: If the user has isolated data and specified that the client session should use an exclusive connection then by setting this condition to true TopLink will ensure that the query is executed through the exclusive connection. This may be required in certain cases. An example being where database security will prevent a query joining to a secure table from returning the correct results when executed through the shared connection.

shouldUseExclusiveConnection

public boolean shouldUseExclusiveConnection()
ADVANCED: If the user has isolated data and specified that the client session should use an exclusive connection then by setting this condition to true TopLink will ensure that the query is executed through the exclusive connection. This may be required in certain cases. An example being where database security will prevent a query joining to a secure table from returning the correct results when executed through the shared connection.

shouldRefreshIdentityMapResult

public boolean shouldRefreshIdentityMapResult()
Set to a boolean. When set means refresh the instance variables of referenceObject from the database.

shouldRefreshRemoteIdentityMapResult

public boolean shouldRefreshRemoteIdentityMapResult()
Set to a boolean. When set means refresh the instance variables of referenceObject from the database.

toString

public java.lang.String toString()
Overrides:
toString in class DatabaseQuery

setShouldProcessResultsInUnitOfWork

public void setShouldProcessResultsInUnitOfWork(boolean processResultsInUnitOfWork)
ADVANCED: Used for CMP only. This allows users to indicate whether cmp finders executed at the beginning of a transaction should always be run against a UnitOfWork. Defaults to true.

If set to false, then UnitOfWork allocation will be deferred until a business method (including creates/removes) or finder with shouldProcessResultsInUnitOfWork == true is invoked. Any finder executed before such a time, will do so against the underlying ServerSession. Forcing finder execution to always go through a UnitOfWork means the results will be cloned and cached in the UnitOfWork up front. This is desired when the results will be accessed in the same transaction.

Note that finders executed with an unspecified transaction context will never be executed against a UnitOfWork, even if this setting is true. This case may happen with the NotSupported, Never, and Supports attributes.


shouldProcessResultsInUnitOfWork

public boolean shouldProcessResultsInUnitOfWork()
ADVANCED: Used for CMP only. Indicates whether cmp finders executed at the beginning of a transaction should always be run against a UnitOfWork. Defaults to true.

If set to false, then UnitOfWork allocation will be deferred until a business method (including creates/removes) or finder with shouldProcessResultsInUnitOfWork == true is invoked. Any finder executed before such a time, will do so against the underlying ServerSession. Forcing finder execution to always go through a UnitOfWork means the results will be cloned and cached in the UnitOfWork up front. This is desired when the results will be accessed in the same transaction.

Note that finders executed with an unspecified transaction context will never be executed against a UnitOfWork, even if this setting is true. This case may happen with the NotSupported, Never, and Supports attributes.


Skip navigation links

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