|
EclipseLink 2.0.0, build 'v20091127-r5931' API Reference | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.eclipse.persistence.queries.DatabaseQuery
org.eclipse.persistence.queries.DoesExistQuery
public class DoesExistQuery
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.
Field Summary | |
---|---|
static int |
AssumeExistence
|
static int |
AssumeNonExistence
|
static int |
CheckCache
|
boolean |
checkCacheFirst
Flag to determine if the cache should be check first in addition to another option. |
static int |
CheckDatabase
|
protected boolean |
checkDatabaseIfInvalid
Flag to determine cache invalidation policy support. |
protected int |
existencePolicy
Flag to determine existence check policy. |
protected java.lang.Object |
object
|
protected java.util.Vector |
primaryKey
Query that is performing the does exist check. |
Constructor Summary | |
---|---|
DoesExistQuery()
PUBLIC: Initialize the state of the query . |
|
DoesExistQuery(Call call)
PUBLIC: Create a query to check if the object exists. |
|
DoesExistQuery(java.lang.Object object)
PUBLIC: Create a query to check if the object exists. |
Method Summary | |
---|---|
void |
assumeExistenceForDoesExist()
PUBLIC: Assume that if the objects primary key does not include null then it must exist. |
void |
assumeNonExistenceForDoesExist()
PUBLIC: Assume that the object does not exist. |
void |
checkCacheForDoesExist()
PUBLIC: Assume that if the objects primary key does not include null and it is in the cache, then is must exist. |
void |
checkDatabaseForDoesExist()
PUBLIC: Perform does exist check on the database through selecting the primary key. |
void |
checkDescriptor(java.lang.Object object,
org.eclipse.persistence.internal.sessions.AbstractSession session)
INTERNAL: Ensure that the descriptor has been set. |
java.lang.Object |
checkEarlyReturn(org.eclipse.persistence.internal.sessions.AbstractSession session,
org.eclipse.persistence.internal.sessions.AbstractRecord translationRow)
INTERNAL: Check if existence can be determined without going to the database. |
java.lang.Object |
checkEarlyReturn(java.lang.Object object,
java.util.Vector primaryKey,
org.eclipse.persistence.internal.sessions.AbstractSession session,
org.eclipse.persistence.internal.sessions.AbstractRecord translationRow)
INTERNAL: Check if existence can be determined without going to the database. |
java.lang.Object |
executeDatabaseQuery()
INTERNAL: Return if the object exists on the database. |
boolean |
getCheckCacheFirst()
INTERNAL: |
boolean |
getCheckDatabaseIfInvalid()
INTERNAL: |
protected org.eclipse.persistence.internal.helper.DatabaseField |
getDoesExistField()
INTERNAL: Return the write lock field or the first primary key field if not using locking. |
int |
getExistencePolicy()
INTERNAL: Return the existence policy for this existence Query |
java.lang.Object |
getObject()
PUBLIC: Return the object. |
java.util.Vector |
getPrimaryKey()
INTERNAL: Return the primaryKey. |
java.lang.Class |
getReferenceClass()
Return the domain class associated with this query. |
java.lang.String |
getReferenceClassName()
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. |
protected void |
prepare()
INTERNAL: Prepare the receiver for execution in a session. |
void |
prepareForExecution()
INTERNAL: Prepare the receiver for execution in a session. |
void |
setCheckCacheFirst(boolean checkCacheFirst)
INTERNAL: Sets checkCacheFirst flag. |
void |
setCheckDatabaseIfInvalid(boolean checkCacheFirst)
INTERNAL: Sets checkDatabaseIfInvalid flag. |
void |
setExistencePolicy(int existencePolicy)
INTERNAL: Set if the existence policy, this must be set to one of the constants. |
void |
setObject(java.lang.Object object)
PUBLIC: Set the object. |
void |
setPrimaryKey(java.util.Vector primaryKey)
INTERNAL: Set the primaryKey. |
boolean |
shouldAssumeExistenceForDoesExist()
PUBLIC: Returns true if the does exist check should be based only on whether the primary key of the object is set |
boolean |
shouldAssumeNonExistenceForDoesExist()
PUBLIC: Returns true if the does exist check should assume non existence. |
boolean |
shouldCheckCacheForDoesExist()
PUBLIC: Returns true if the does exist check should be based only on a cache check. |
boolean |
shouldCheckDatabaseForDoesExist()
PUBLIC: Returns true if the does exist check should query the database. |
Methods inherited from class java.lang.Object |
---|
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static final int AssumeNonExistence
public static final int AssumeExistence
public static final int CheckCache
public static final int CheckDatabase
protected java.util.Vector primaryKey
protected java.lang.Object object
protected int existencePolicy
protected boolean checkDatabaseIfInvalid
public boolean checkCacheFirst
Constructor Detail |
---|
public DoesExistQuery()
public DoesExistQuery(java.lang.Object object)
public DoesExistQuery(Call call)
Method Detail |
---|
public void assumeExistenceForDoesExist()
public void assumeNonExistenceForDoesExist()
public void checkCacheForDoesExist()
public void checkDatabaseForDoesExist()
public java.lang.Object checkEarlyReturn(java.lang.Object object, java.util.Vector primaryKey, org.eclipse.persistence.internal.sessions.AbstractSession session, org.eclipse.persistence.internal.sessions.AbstractRecord translationRow)
public java.lang.Object checkEarlyReturn(org.eclipse.persistence.internal.sessions.AbstractSession session, org.eclipse.persistence.internal.sessions.AbstractRecord translationRow)
checkEarlyReturn
in class DatabaseQuery
public java.lang.Object executeDatabaseQuery() throws DatabaseException
executeDatabaseQuery
in class DatabaseQuery
DatabaseException
- - an error has occurred on the database.protected org.eclipse.persistence.internal.helper.DatabaseField getDoesExistField()
public int getExistencePolicy()
public java.lang.Object getObject()
public java.util.Vector getPrimaryKey()
public java.lang.Class getReferenceClass()
getReferenceClass
in class DatabaseQuery
public java.lang.String getReferenceClassName()
getReferenceClassName
in class DatabaseQuery
protected void prepare() throws QueryException
prepare
in class DatabaseQuery
QueryException
public void checkDescriptor(java.lang.Object object, org.eclipse.persistence.internal.sessions.AbstractSession session) throws QueryException
QueryException
public void prepareForExecution() throws QueryException
prepareForExecution
in class DatabaseQuery
QueryException
public void setExistencePolicy(int existencePolicy)
public void setObject(java.lang.Object object)
public void setPrimaryKey(java.util.Vector primaryKey)
public boolean shouldAssumeExistenceForDoesExist()
public boolean shouldAssumeNonExistenceForDoesExist()
public boolean shouldCheckCacheForDoesExist()
public boolean shouldCheckDatabaseForDoesExist()
public void setCheckCacheFirst(boolean checkCacheFirst)
checkCacheFirst
- public boolean getCheckCacheFirst()
checkCacheFirst
- public void setCheckDatabaseIfInvalid(boolean checkCacheFirst)
checkDatabaseIfInvalid
- public boolean getCheckDatabaseIfInvalid()
checkDatabaseIfInvalid
-
|
EclipseLink 2.0.0, build 'v20091127-r5931' API Reference | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |