Class DeleteObjectQuery

All Implemented Interfaces:
Serializable, Cloneable

public class DeleteObjectQuery extends ObjectLevelModifyQuery

Purpose: Used for deleting objects.

Responsibilities: Extract primary key from object and delete it.

See Also:
Author:
Yvon Lavoie
  • Field Details

    • isFullRowRequired

      protected boolean isFullRowRequired
      PERF: By default only the translation row is used for deletes, the full row can be requested for custom deletes.
    • usesOptimisticLocking

      protected boolean usesOptimisticLocking
      Indicates whether the query should use optimistic locking.
  • Constructor Details

    • DeleteObjectQuery

      public DeleteObjectQuery()
    • DeleteObjectQuery

      public DeleteObjectQuery(Object objectToDelete)
    • DeleteObjectQuery

      public DeleteObjectQuery(Call call)
  • Method Details

    • isFullRowRequired

      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.
    • setIsFullRowRequired

      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.
    • checkForCustomQuery

      protected DatabaseQuery checkForCustomQuery(org.eclipse.persistence.internal.sessions.AbstractSession session, org.eclipse.persistence.internal.sessions.AbstractRecord translationRow)
      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.
      Overrides:
      checkForCustomQuery in class DatabaseQuery
    • executeInUnitOfWorkObjectLevelModifyQuery

      protected Object executeInUnitOfWorkObjectLevelModifyQuery(org.eclipse.persistence.internal.sessions.UnitOfWorkImpl unitOfWork, org.eclipse.persistence.internal.sessions.AbstractRecord translationRow) throws DatabaseException, OptimisticLockException
      INTERNAL: Code was moved from UnitOfWork.internalExecuteQuery
      Overrides:
      executeInUnitOfWorkObjectLevelModifyQuery in class ObjectLevelModifyQuery
      Parameters:
      unitOfWork -
      translationRow -
      Returns:
      Throws:
      DatabaseException
      OptimisticLockException
    • getDefaultRedirector

      protected QueryRedirector getDefaultRedirector()
      INTERNAL: Returns the specific default redirector for this query type. There are numerous default query redirectors. See ClassDescriptor for their types.
      Overrides:
      getDefaultRedirector in class DatabaseQuery
    • executeDatabaseQuery

      public Object executeDatabaseQuery() throws DatabaseException, OptimisticLockException
      INTERNAL: Perform the work to delete an object.
      Specified by:
      executeDatabaseQuery in class DatabaseQuery
      Returns:
      object - the object being deleted.
      Throws:
      DatabaseException - - an error has occurred on the database.
      OptimisticLockException - - an error has occurred using the optimistic lock feature.
    • isDeleteObjectQuery

      public boolean isDeleteObjectQuery()
      PUBLIC: Return if this is a delete object query.
      Overrides:
      isDeleteObjectQuery in class DatabaseQuery
    • setObject

      public void setObject(Object object)
      PUBLIC: (REQUIRED) Set the object required for modification.
      Overrides:
      setObject in class ObjectLevelModifyQuery
    • shouldUseOptimisticLocking

      protected boolean shouldUseOptimisticLocking(Object object)
      INTERNAL: Determines whether the query should use optimistic locking with the passed object.
    • usesOptimisticLocking

      public boolean usesOptimisticLocking()
      INTERNAL: Indicating whether the query should use optimistic locking.
    • prepare

      protected void prepare()
      INTERNAL: Prepare the receiver for execution in a session.
      Overrides:
      prepare in class ObjectLevelModifyQuery
    • prepareCustomQuery

      protected void prepareCustomQuery(DatabaseQuery customQuery)
      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.
      Overrides:
      prepareCustomQuery in class DatabaseQuery
    • prepareForExecution

      public void prepareForExecution() throws QueryException
      INTERNAL: Prepare the receiver for execution in a session. In particular, verify that the object is not null and contains a valid primary key.
      Overrides:
      prepareForExecution in class ObjectLevelModifyQuery
      Throws:
      QueryException