Top Description Fields Constructors Methods
org.eclipse.persistence.queries

public Class DeleteObjectQuery

extends ObjectLevelModifyQuery
Class Inheritance
Imports
java.util.Set, org.eclipse.persistence.internal.sessions.AbstractRecord, .AbstractSession, .CommitManager, .UnitOfWorkImpl, org.eclipse.persistence.mappings.DatabaseMapping.WriteType, org.eclipse.persistence.exceptions.*, org.eclipse.persistence.descriptors.ClassDescriptor, .DescriptorEvent, .DescriptorEventManager, .DescriptorQueryManager, .FetchGroupManager, org.eclipse.persistence.tools.profiler.QueryMonitor

Purpose: Used for deleting objects.

Responsibilities: Extract primary key from object and delete it.

Author
Yvon Lavoie
Since
TOPLink/Java 1.0

Field Summary

Modifier and TypeField and Description
protected boolean
isFullRowRequired

PERF: By default only the translation row is used for deletes, the full row can be requested for custom deletes.

protected boolean
usesOptimisticLocking

Indicates whether the query should use optimistic locking.

Inherited from org.eclipse.persistence.queries.ObjectLevelModifyQuery:
backupCloneobjectobjectChangeSetprimaryKey

Constructor Summary

AccessConstructor and Description
public
public
DeleteObjectQuery(Object objectToDelete)

public

Method Summary

Modifier and TypeMethod and Description
protected DatabaseQuery
checkForCustomQuery(AbstractSession session, AbstractRecord translationRow)

Overrides org.eclipse.persistence.queries.DatabaseQuery.checkForCustomQuery.

INTERNAL: Check to see if a custom query should be used for this query.
public Object

Returns:

object - the object being deleted.
executeDatabaseQuery
()

Implements abstract org.eclipse.persistence.queries.DatabaseQuery.executeDatabaseQuery.

INTERNAL: Perform the work to delete an object.
protected Object
protected QueryRedirector
getDefaultRedirector()

Overrides org.eclipse.persistence.queries.DatabaseQuery.getDefaultRedirector.

INTERNAL: Returns the specific default redirector for this query type.
public boolean
isDeleteObjectQuery()

Overrides org.eclipse.persistence.queries.DatabaseQuery.isDeleteObjectQuery.

PUBLIC: Return if this is a delete object query.
public boolean
isFullRowRequired()

ADVANCED: Return if the full row is required by the delete query.

protected void
prepare()

Overrides org.eclipse.persistence.queries.ObjectLevelModifyQuery.prepare.

INTERNAL: Prepare the receiver for execution in a session.
protected void
prepareCustomQuery(DatabaseQuery customQuery)

Overrides org.eclipse.persistence.queries.DatabaseQuery.prepareCustomQuery.

INTERNAL: Set the properties needed to be cascaded into the custom query.
public void
prepareForExecution()

Overrides org.eclipse.persistence.queries.ObjectLevelModifyQuery.prepareForExecution.

INTERNAL: Prepare the receiver for execution in a session.
public void
setIsFullRowRequired(boolean isFullRowRequired)

ADVANCED: Set if the full row is required by the delete query.

public void
setObject(Object object)

Overrides org.eclipse.persistence.queries.ObjectLevelModifyQuery.setObject.

PUBLIC: (REQUIRED) Set the object required for modification.
protected boolean
shouldUseOptimisticLocking(Object object)

INTERNAL: Determines whether the query should use optimistic locking with the passed object.

public boolean
usesOptimisticLocking()

INTERNAL: Indicating whether the query should use optimistic locking.

Inherited from org.eclipse.persistence.queries.ObjectLevelModifyQuery:
checkDescriptorexecuteInUnitOfWorkgetBackupClonegetObjectgetObjectChangeSetgetPrimaryKeygetReferenceClassgetReferenceClassNameisObjectLevelModifyQueryresetMonitorNamesetBackupClonesetObjectChangeSetsetPrimaryKeytoString

Field Detail

isFullRowRequiredback to summary
protected boolean isFullRowRequired

PERF: By default only the translation row is used for deletes, the full row can be requested for custom deletes.

usesOptimisticLockingback to summary
protected boolean usesOptimisticLocking

Indicates whether the query should use optimistic locking.

Constructor Detail

DeleteObjectQueryback to summary
public DeleteObjectQuery()
DeleteObjectQueryback to summary
public DeleteObjectQuery(Object objectToDelete)
DeleteObjectQueryback to summary
public DeleteObjectQuery(Call call)

Method Detail

checkForCustomQueryback to summary
protected DatabaseQuery checkForCustomQuery(AbstractSession session, AbstractRecord translationRow)

Overrides org.eclipse.persistence.queries.DatabaseQuery.checkForCustomQuery.

INTERNAL: Check to see if a custom query should be used for this query. This is done before the query is copied and prepared/executed. null means there is none.

Annotations
@Override
executeDatabaseQueryback to summary
public Object executeDatabaseQuery() throws DatabaseException, OptimisticLockException

Implements abstract org.eclipse.persistence.queries.DatabaseQuery.executeDatabaseQuery.

INTERNAL: Perform the work to delete an object.

Returns:Object

object - the object being deleted.

Annotations
@Override
Exceptions
DatabaseException:

Doc from org.eclipse.persistence.queries.DatabaseQuery.executeDatabaseQuery.

- an error has occurred on the database.

OptimisticLockException:

Doc from org.eclipse.persistence.queries.DatabaseQuery.executeDatabaseQuery.

- an error has occurred using the optimistic lock feature.

executeInUnitOfWorkObjectLevelModifyQueryback to summary
protected Object executeInUnitOfWorkObjectLevelModifyQuery(UnitOfWorkImpl unitOfWork, AbstractRecord translationRow) throws DatabaseException, OptimisticLockException

Overrides org.eclipse.persistence.queries.ObjectLevelModifyQuery.executeInUnitOfWorkObjectLevelModifyQuery.

INTERNAL: Code was moved from UnitOfWork.internalExecuteQuery

Annotations
@Override
getDefaultRedirectorback to summary
protected QueryRedirector getDefaultRedirector()

Overrides org.eclipse.persistence.queries.DatabaseQuery.getDefaultRedirector.

INTERNAL: Returns the specific default redirector for this query type. There are numerous default query redirectors. See ClassDescriptor for their types.

Annotations
@Override
isDeleteObjectQueryback to summary
public boolean isDeleteObjectQuery()

Overrides org.eclipse.persistence.queries.DatabaseQuery.isDeleteObjectQuery.

PUBLIC: Return if this is a delete object query.

Annotations
@Override
isFullRowRequiredback to summary
public boolean isFullRowRequired()

ADVANCED: Return if the full row is required by the delete query. This can be set on custom delete queries if more than the objects primary key and version is required.

prepareback to summary
protected void prepare()

Overrides org.eclipse.persistence.queries.ObjectLevelModifyQuery.prepare.

INTERNAL: Prepare the receiver for execution in a session.

Annotations
@Override
prepareCustomQueryback to summary
protected void prepareCustomQuery(DatabaseQuery customQuery)

Overrides org.eclipse.persistence.queries.DatabaseQuery.prepareCustomQuery.

INTERNAL: Set the properties needed to be cascaded into the custom query. A custom query is set by the user, or used by default to allow caching of the prepared query. In a unit of work the custom query is used directly, so this step is bypassed.

Annotations
@Override
prepareForExecutionback to summary
public void prepareForExecution() throws QueryException

Overrides org.eclipse.persistence.queries.ObjectLevelModifyQuery.prepareForExecution.

INTERNAL: Prepare the receiver for execution in a session. In particular, verify that the object is not null and contains a valid primary key.

Annotations
@Override
setIsFullRowRequiredback to summary
public void setIsFullRowRequired(boolean isFullRowRequired)

ADVANCED: Set if the full row is required by the delete query. This can be set on custom delete queries if more than the objects primary key and version is required.

setObjectback to summary
public void setObject(Object object)

Overrides org.eclipse.persistence.queries.ObjectLevelModifyQuery.setObject.

PUBLIC: (REQUIRED) Set the object required for modification.

Annotations
@Override
shouldUseOptimisticLockingback to summary
protected boolean shouldUseOptimisticLocking(Object object)

INTERNAL: Determines whether the query should use optimistic locking with the passed object.

usesOptimisticLockingback to summary
public boolean usesOptimisticLocking()

INTERNAL: Indicating whether the query should use optimistic locking.