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

B32476-03

oracle.toplink.queryframework
Class DoesExistQuery

java.lang.Object
  extended by oracle.toplink.queryframework.DatabaseQuery
      extended by oracle.toplink.queryframework.DoesExistQuery
All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable, oracle.toplink.internal.helper.FalseUndefinedTrue

public class DoesExistQuery
extends DatabaseQuery

Purpose: This should only be used by the descriptor, this should not be executed directly. Used to determine if an object resides on the database. DoesExistQuery is normally used to determine whether to make an update or insert statement when writing an object.

Responsibilities: Verify the existence of an object. Used only by a write object query.

Since:
TOPLink/Java 1.0
11/26/2008 - 11.1.1.1.0 Michael O'Brien - 7596027: Remove TopLink JPA provider which is replaced by org.eclipse.persistence.jpa.PersistenceProvider
See Also:
Serialized Form

Field Summary
static int AssumeExistence
           
static int AssumeNonExistence
           
static int CheckCache
           
 boolean checkCacheFirst
          Flag to get checkearlyreturn to override assume(non)existence and database checks with a cache check
static int CheckDatabase
           
 
Fields inherited from class oracle.toplink.queryframework.DatabaseQuery
CascadeAggregateDelete, CascadeAllParts, CascadeByMapping, CascadeDependentParts, CascadePrivateParts, NoCascading
 
Constructor Summary
DoesExistQuery()
          Initialize the state of the query .
DoesExistQuery(Call call)
          Create a query to check if the object exists.
DoesExistQuery(java.lang.Object object)
          Create a query to check if the object exists.
 
Method Summary
 void assumeExistenceForDoesExist()
          Assume that if the objects primary key does not include null then it must exist.
 void assumeNonExistenceForDoesExist()
          Assume that the object does not exist.
 void checkCacheForDoesExist()
          Assume that if the objects primary key does not include null and it is in the cache, then is must exist.
 void checkDatabaseForDoesExist()
          Perform does exist check on the database through selecting the primary key.
 java.lang.Object getObject()
          Return the object.
 java.lang.Class getReferenceClass()
          Return the domain class associated with this query.
 void setObject(java.lang.Object object)
          Set the object.
 boolean shouldAssumeExistenceForDoesExist()
          Returns true if the does exist check should be based only on whether the primary key of the object is set
 boolean shouldAssumeNonExistenceForDoesExist()
          Returns true if the does exist check should assume non existence.
 boolean shouldCheckCacheForDoesExist()
          Returns true if the does exist check should be based only on a cache check.
 boolean shouldCheckDatabaseForDoesExist()
          Returns true if the does exist check should query the database.
 
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, isObjectBuildingQuery, isObjectLevelModifyQuery, isObjectLevelReadQuery, isReadAllQuery, isReadObjectQuery, isReadQuery, 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, toString
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

AssumeNonExistence

public static final int AssumeNonExistence
See Also:
Constant Field Values

AssumeExistence

public static final int AssumeExistence
See Also:
Constant Field Values

CheckCache

public static final int CheckCache
See Also:
Constant Field Values

CheckDatabase

public static final int CheckDatabase
See Also:
Constant Field Values

checkCacheFirst

public boolean checkCacheFirst
Description copied from class: DoesExistQuery
Flag to get checkearlyreturn to override assume(non)existence and database checks with a cache check

Constructor Detail

DoesExistQuery

public DoesExistQuery()
Initialize the state of the query . By default the cache is checked, if non cache is used the descriptor should throw a exception and validate.


DoesExistQuery

public DoesExistQuery(java.lang.Object object)
Create a query to check if the object exists.


DoesExistQuery

public DoesExistQuery(Call call)
Create a query to check if the object exists.

Method Detail

assumeExistenceForDoesExist

public void assumeExistenceForDoesExist()
Assume that if the objects primary key does not include null then it must exist. This may be used if the user's system garentees that an object with non-null key exists.


assumeNonExistenceForDoesExist

public void assumeNonExistenceForDoesExist()
Assume that the object does not exist. This may be used if the user's system garentees objects must always be inserted.


checkCacheForDoesExist

public void checkCacheForDoesExist()
Assume that if the objects primary key does not include null and it is in the cache, then is must exist. This should only be used if a full identity map is being used, and a new object in the client cannot have been inserted by another client.


checkDatabaseForDoesExist

public void checkDatabaseForDoesExist()
Perform does exist check on the database through selecting the primary key.


getObject

public java.lang.Object getObject()
Return the object.


getReferenceClass

public java.lang.Class getReferenceClass()
Return the domain class associated with this query.

Overrides:
getReferenceClass in class DatabaseQuery

setObject

public void setObject(java.lang.Object object)
Set the object.


shouldAssumeExistenceForDoesExist

public boolean shouldAssumeExistenceForDoesExist()
Returns true if the does exist check should be based only on whether the primary key of the object is set


shouldAssumeNonExistenceForDoesExist

public boolean shouldAssumeNonExistenceForDoesExist()
Returns true if the does exist check should assume non existence.


shouldCheckCacheForDoesExist

public boolean shouldCheckCacheForDoesExist()
Returns true if the does exist check should be based only on a cache check. Default behavior.


shouldCheckDatabaseForDoesExist

public boolean shouldCheckDatabaseForDoesExist()
Returns true if the does exist check should query the database.


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