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.
| Modifier and Type | Field and Description |
|---|---|
| public static final int | |
| public static final int | |
| public static final int | |
| public boolean | checkCacheFirst
Flag to determine if the cache should be check first in addition to another option. |
| public static final int | |
| protected boolean | checkDatabaseIfInvalid
Flag to determine cache invalidation policy support. |
| protected int | existencePolicy
Flag to determine existence check policy. |
| protected Object | |
| protected Object | primaryKey
Query that is performing the does exist check. |
| Access | Constructor and Description |
|---|---|
| public | |
| public | |
| public |
| Modifier and Type | Method and Description |
|---|---|
| public void | assumeExistenceForDoesExist()
PUBLIC: Assume that if the objects primary key does not include null then it must exist. |
| public void | |
| public void | checkCacheForDoesExist()
PUBLIC: Assume that if the objects primary key does not include null and it is in the cache, then is must exist. |
| public void | checkDatabaseForDoesExist()
PUBLIC: Perform does exist check on the database through selecting the primary key. |
| public void | checkDescriptor(Object object, AbstractSession session)
INTERNAL: Ensure that the descriptor has been set. |
| public Object | checkEarlyReturn(Object object, Object primaryKey, AbstractSession session, AbstractRecord translationRow)
INTERNAL: Check if existence can be determined without going to the database. |
| public Object | checkEarlyReturn(AbstractSession session, AbstractRecord translationRow)
Overrides org. |
| public Object | executeDatabaseQuery()
Implements abstract org. |
| public boolean | |
| public boolean | |
| protected DatabaseField | getDoesExistField()
INTERNAL: Return the write lock field or the first primary key field if not using locking. |
| public int | |
| public Object | |
| public Object | |
| public Class | getReferenceClass()
Overrides org. |
| public String | getReferenceClassName()
Overrides org. |
| protected void | prepare()
Overrides org. |
| public void | prepareForExecution()
Overrides org. |
| public void | |
| public void | |
| public void | setExistencePolicy(int existencePolicy)
INTERNAL: Set if the existence policy, this must be set to one of the constants. |
| public void | |
| public void | |
| public boolean | shouldAssumeExistenceForDoesExist()
PUBLIC: Returns true if the does exist check should be based only on whether the primary key of the object is set |
| public boolean | shouldAssumeNonExistenceForDoesExist()
PUBLIC: Returns true if the does exist check should assume non existence. |
| public boolean | shouldCheckCacheForDoesExist()
PUBLIC: Returns true if the does exist check should be based only on a cache check. |
| public boolean | shouldCheckDatabaseForDoesExist()
PUBLIC: Returns true if the does exist check should query the database. |
| AssumeExistence | back to summary |
|---|---|
| public static final int AssumeExistence | |
| AssumeNonExistence | back to summary |
|---|---|
| public static final int AssumeNonExistence | |
| CheckCache | back to summary |
|---|---|
| public static final int CheckCache | |
| checkCacheFirst | back to summary |
|---|---|
| public boolean checkCacheFirst Flag to determine if the cache should be check first in addition to another option. The default is true; | |
| CheckDatabase | back to summary |
|---|---|
| public static final int CheckDatabase | |
| checkDatabaseIfInvalid | back to summary |
|---|---|
| protected boolean checkDatabaseIfInvalid Flag to determine cache invalidation policy support. This overrides the CheckCache existence setting if the object is invalid or if the cache cannot be trusted because a flush or DML has occurred. The default is true. | |
| existencePolicy | back to summary |
|---|---|
| protected int existencePolicy Flag to determine existence check policy. | |
| object | back to summary |
|---|---|
| protected Object object | |
| primaryKey | back to summary |
|---|---|
| protected Object primaryKey Query that is performing the does exist check. | |
| DoesExistQuery | back to summary |
|---|---|
| public DoesExistQuery() PUBLIC: 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 | back to summary |
|---|---|
| public DoesExistQuery(Object object) PUBLIC: Create a query to check if the object exists. | |
| DoesExistQuery | back to summary |
|---|---|
| public DoesExistQuery(Call call) PUBLIC: Create a query to check if the object exists. | |
| assumeExistenceForDoesExist | back to summary |
|---|---|
| public void assumeExistenceForDoesExist() PUBLIC: Assume that if the objects primary key does not include null then it must exist. This may be used if the user's system guarantees that an object with non-null key exists. | |
| assumeNonExistenceForDoesExist | back to summary |
|---|---|
| public void assumeNonExistenceForDoesExist() PUBLIC: Assume that the object does not exist. This may be used if the user's system guarantees objects must always be inserted. | |
| checkCacheForDoesExist | back to summary |
|---|---|
| public void checkCacheForDoesExist() PUBLIC: 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 | back to summary |
|---|---|
| public void checkDatabaseForDoesExist() PUBLIC: Perform does exist check on the database through selecting the primary key. | |
| checkDescriptor | back to summary |
|---|---|
| public void checkDescriptor(Object object, AbstractSession session) throws QueryException INTERNAL: Ensure that the descriptor has been set. | |
| checkEarlyReturn | back to summary |
|---|---|
| public Object checkEarlyReturn(Object object, Object primaryKey, AbstractSession session, AbstractRecord translationRow) INTERNAL: Check if existence can be determined without going to the database. Note that custom query check is not require for does exist as the custom is always used. Used by unit of work, and will return null if checkDatabaseIfInvalid is set and the cachekey is invalidated | |
| checkEarlyReturn | back to summary |
|---|---|
| public Object checkEarlyReturn(AbstractSession session, AbstractRecord translationRow) Overrides org. INTERNAL: Check if existence can be determined without going to the database. Note that custom query check is not require for does exist as the custom is always used.
| |
| executeDatabaseQuery | back to summary |
|---|---|
| public Object executeDatabaseQuery() throws DatabaseException Implements abstract org. INTERNAL: Return if the object exists on the database. This must be a Boolean object to conform with returning an object. If using optimistic locking, check that the value matches.
| |
| getCheckCacheFirst | back to summary |
|---|---|
| public boolean getCheckCacheFirst() INTERNAL: | |
| getCheckDatabaseIfInvalid | back to summary |
|---|---|
| public boolean getCheckDatabaseIfInvalid() INTERNAL: | |
| getDoesExistField | back to summary |
|---|---|
| protected DatabaseField getDoesExistField() INTERNAL: Return the write lock field or the first primary key field if not using locking. | |
| getExistencePolicy | back to summary |
|---|---|
| public int getExistencePolicy() INTERNAL: Return the existence policy for this existence Query | |
| getObject | back to summary |
|---|---|
| public Object getObject() PUBLIC: Return the object. | |
| getPrimaryKey | back to summary |
|---|---|
| public Object getPrimaryKey() INTERNAL: Return the primaryKey. | |
| getReferenceClass | back to summary |
|---|---|
| public Class Overrides org. Return the domain class associated with this query.
| |
| getReferenceClassName | back to summary |
|---|---|
| public String getReferenceClassName() Overrides org. INTERNAL: Return the name of the reference class for this query Note: Although the API is designed to avoid requirement of classes being on the classpath, this is not a user defined query type, so it is ok to access the class.
| |
| prepare | back to summary |
|---|---|
| protected void prepare() throws QueryException Overrides org. INTERNAL: Prepare the receiver for execution in a session.
| |
| prepareForExecution | back to summary |
|---|---|
| public void prepareForExecution() throws QueryException Overrides org. INTERNAL: Prepare the receiver for execution in a session.
| |
| setCheckCacheFirst | back to summary |
|---|---|
| public void setCheckCacheFirst(boolean checkCacheFirst) INTERNAL: Sets checkCacheFirst flag. If true, existence check will first go to the cache. It will then check other options if it is not found in the cache | |
| setCheckDatabaseIfInvalid | back to summary |
|---|---|
| public void setCheckDatabaseIfInvalid(boolean checkCacheFirst) INTERNAL: Sets checkDatabaseIfInvalid flag. If true, query will go to the database when it finds the object in the cache and it is invalid. This is only valid when it checks the cache, and is true by default | |
| setExistencePolicy | back to summary |
|---|---|
| public void setExistencePolicy(int existencePolicy) INTERNAL: Set if the existence policy, this must be set to one of the constants. | |
| setObject | back to summary |
|---|---|
| public void setObject(Object object) PUBLIC: Set the object. | |
| setPrimaryKey | back to summary |
|---|---|
| public void setPrimaryKey(Object primaryKey) INTERNAL: Set the primaryKey. | |
| shouldAssumeExistenceForDoesExist | back to summary |
|---|---|
| public boolean shouldAssumeExistenceForDoesExist() PUBLIC: Returns true if the does exist check should be based only on whether the primary key of the object is set | |
| shouldAssumeNonExistenceForDoesExist | back to summary |
|---|---|
| public boolean shouldAssumeNonExistenceForDoesExist() PUBLIC: Returns true if the does exist check should assume non existence. | |
| shouldCheckCacheForDoesExist | back to summary |
|---|---|
| public boolean shouldCheckCacheForDoesExist() PUBLIC: Returns true if the does exist check should be based only on a cache check. Default behavior. | |
| shouldCheckDatabaseForDoesExist | back to summary |
|---|---|
| public boolean shouldCheckDatabaseForDoesExist() PUBLIC: Returns true if the does exist check should query the database. | |