Package org.eclipse.persistence.queries
Class DeleteObjectQuery
- java.lang.Object
-
- org.eclipse.persistence.queries.DatabaseQuery
-
- org.eclipse.persistence.queries.ModifyQuery
-
- org.eclipse.persistence.queries.ObjectLevelModifyQuery
-
- org.eclipse.persistence.queries.DeleteObjectQuery
-
- All Implemented Interfaces:
java.io.Serializable,java.lang.Cloneable
public class DeleteObjectQuery extends ObjectLevelModifyQuery
Purpose: Used for deleting objects.
Responsibilities: Extract primary key from object and delete it.
- See Also:
- Serialized Form
- Author:
- Yvon Lavoie
- Since:
- TOPLink/Java 1.0
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class org.eclipse.persistence.queries.DatabaseQuery
DatabaseQuery.ParameterType
-
-
Field Summary
Fields Modifier and Type Field Description protected booleanisFullRowRequiredPERF: By default only the translation row is used for deletes, the full row can be requested for custom deletes.protected booleanusesOptimisticLockingIndicates whether the query should use optimistic locking.-
Fields inherited from class org.eclipse.persistence.queries.ObjectLevelModifyQuery
backupClone, object, objectChangeSet, primaryKey
-
Fields inherited from class org.eclipse.persistence.queries.ModifyQuery
forceBatchStatementExecution, isBatchExecutionSupported, modifyRow
-
Fields inherited from class org.eclipse.persistence.queries.DatabaseQuery
accessors, allowNativeSQLQuery, argumentFields, argumentParameterTypes, arguments, argumentTypeNames, argumentTypes, argumentValues, BATCH_FETCH_PROPERTY, CascadeAggregateDelete, CascadeAllParts, CascadeByMapping, CascadeDependentParts, cascadePolicy, CascadePrivateParts, descriptor, descriptors, doNotRedirect, executionSession, flushOnExecute, hintString, isCustomQueryUsed, isExecutionClone, isNativeConnectionRequired, isPrepared, isUserDefined, isUserDefinedSQLCall, monitorName, name, NoCascading, nullableArguments, parameterDelimiter, partitioningPolicy, properties, queryMechanism, queryTimeout, queryTimeoutUnit, redirector, session, sessionName, shouldBindAllParameters, shouldCacheStatement, shouldCloneCall, shouldMaintainCache, shouldPrepare, shouldRetrieveBypassCache, shouldReturnGeneratedKeys, shouldStoreBypassCache, shouldUseWrapperPolicy, shouldValidateUpdateCallCacheUse, sourceMapping, translationRow
-
-
Constructor Summary
Constructors Constructor Description DeleteObjectQuery()DeleteObjectQuery(java.lang.Object objectToDelete)DeleteObjectQuery(Call call)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected DatabaseQuerycheckForCustomQuery(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.java.lang.ObjectexecuteDatabaseQuery()INTERNAL: Perform the work to delete an object.protected java.lang.ObjectexecuteInUnitOfWorkObjectLevelModifyQuery(org.eclipse.persistence.internal.sessions.UnitOfWorkImpl unitOfWork, org.eclipse.persistence.internal.sessions.AbstractRecord translationRow)INTERNAL: Code was moved from UnitOfWork.internalExecuteQueryprotected QueryRedirectorgetDefaultRedirector()INTERNAL: Returns the specific default redirector for this query type.booleanisDeleteObjectQuery()PUBLIC: Return if this is a delete object query.booleanisFullRowRequired()ADVANCED: Return if the full row is required by the delete query.protected voidprepare()INTERNAL: Prepare the receiver for execution in a session.protected voidprepareCustomQuery(DatabaseQuery customQuery)INTERNAL: Set the properties needed to be cascaded into the custom query.voidprepareForExecution()INTERNAL: Prepare the receiver for execution in a session.voidsetIsFullRowRequired(boolean isFullRowRequired)ADVANCED: Set if the full row is required by the delete query.voidsetObject(java.lang.Object object)PUBLIC: (REQUIRED) Set the object required for modification.protected booleanshouldUseOptimisticLocking(java.lang.Object object)INTERNAL: Determines whether the query should use optimistic locking with the passed object.booleanusesOptimisticLocking()INTERNAL: Indicating whether the query should use optimistic locking.-
Methods inherited from class org.eclipse.persistence.queries.ObjectLevelModifyQuery
checkDescriptor, executeInUnitOfWork, getBackupClone, getObject, getObjectChangeSet, getPrimaryKey, getReferenceClass, getReferenceClassName, isObjectLevelModifyQuery, resetMonitorName, setBackupClone, setObjectChangeSet, setPrimaryKey, toString
-
Methods inherited from class org.eclipse.persistence.queries.ModifyQuery
forceBatchStatementExecution, getModifyRow, isBatchExecutionSupported, isModifyQuery, setForceBatchStatementExecution, setIsBatchExecutionSupported, setModifyRow
-
Methods inherited from class org.eclipse.persistence.queries.DatabaseQuery
addArgument, addArgument, addArgument, addArgument, addArgument, addArgument, addArgumentByTypeName, addArgumentValue, addArgumentValues, addCall, addStatement, bindAllParameters, buildArgumentFields, buildSelectionCriteria, cacheStatement, cascadeAllParts, cascadeByMapping, cascadeOnlyDependentParts, cascadePrivateParts, checkEarlyReturn, checkPrepare, checkPrepare, clone, clonedQueryExecutionComplete, convertClassNamesToClasses, copyFromQuery, dontBindAllParameters, dontCacheStatement, dontCascadeParts, dontMaintainCache, execute, extractRemoteResult, getAccessor, getAccessors, getArgumentParameterTypes, getArguments, getArgumentTypeNames, getArgumentTypes, getArgumentValues, getBatchObjects, getCall, getCascadePolicy, getDatasourceCall, getDatasourceCalls, getDescriptor, getDescriptors, getDomainClassNounName, getDoNotRedirect, getEJBQLString, getExecutionSession, getFlushOnExecute, getHintString, getJPQLString, getMonitorName, getName, getNullableArguments, getParameterDelimiter, getParameterDelimiterChar, getPartitioningPolicy, getProperties, getProperty, getQueryMechanism, getQueryNounName, getQueryTimeout, getQueryTimeoutUnit, getRedirector, getRedirectorForQuery, getSelectionCriteria, getSensorName, getSession, getSessionName, getShouldBindAllParameters, getSourceMapping, getSQLStatement, getSQLString, getSQLStrings, getTranslatedSQLString, getTranslatedSQLStrings, getTranslationRow, hasAccessor, hasArguments, hasNullableArguments, hasProperties, hasQueryMechanism, hasSessionName, ignoreBindAllParameters, ignoreCacheStatement, isCallQuery, isCascadeOfAggregateDelete, isCustomQueryUsed, isCustomSelectionQuery, isDataModifyQuery, isDataReadQuery, isDefaultPropertiesQuery, isDeleteAllQuery, isDirectReadQuery, isExecutionClone, isExpressionQuery, isInsertObjectQuery, isJPQLCallQuery, isModifyAllQuery, isNativeConnectionRequired, isObjectBuildingQuery, isObjectLevelReadQuery, isPrepared, isReadAllQuery, isReadObjectQuery, isReadQuery, isReportQuery, isResultSetMappingQuery, isSQLCallQuery, isUpdateAllQuery, isUpdateObjectQuery, isUserDefined, isUserDefinedSQLCall, isValueReadQuery, isWriteObjectQuery, maintainCache, prepareCall, prepareForRemoteExecution, prepareFromQuery, prepareInternal, redirectQuery, remoteExecute, remoteExecute, removeProperty, replaceValueHoldersIn, retrieveBypassCache, rowFromArguments, setAccessor, setAccessors, setAllowNativeSQLQuery, setArguments, setArgumentTypeNames, setArgumentTypes, setArgumentValues, setBatchObjects, setCall, setCascadePolicy, setDatasourceCall, setDescriptor, setDoNotRedirect, setEJBQLString, setExecutionSession, setFlushOnExecute, setHintString, setIsCustomQueryUsed, setIsExecutionClone, setIsNativeConnectionRequired, setIsPrepared, setIsUserDefined, setIsUserDefinedSQLCall, setJPQLString, setName, setNullableArguments, setParameterDelimiter, setPartitioningPolicy, setProperties, setProperty, setQueryMechanism, setQueryTimeout, setQueryTimeoutUnit, setRedirector, setSelectionCriteria, setSession, setSessionName, setShouldBindAllParameters, setShouldBindAllParameters, setShouldCacheStatement, setShouldMaintainCache, setShouldPrepare, setShouldRetrieveBypassCache, setShouldReturnGeneratedKeys, setShouldStoreBypassCache, setShouldUseWrapperPolicy, setShouldValidateUpdateCallCacheUse, setSourceMapping, setSQLStatement, setSQLString, setTranslationRow, shouldAllowNativeSQLQuery, shouldBindAllParameters, shouldCacheStatement, shouldCascadeAllParts, shouldCascadeByMapping, shouldCascadeOnlyDependentParts, shouldCascadeParts, shouldCascadePrivateParts, shouldCloneCall, shouldIgnoreBindAllParameters, shouldIgnoreCacheStatement, shouldMaintainCache, shouldPrepare, shouldPrepare, shouldRetrieveBypassCache, shouldReturnGeneratedKeys, shouldStoreBypassCache, shouldUseWrapperPolicy, shouldValidateUpdateCallCacheUse, storeBypassCache
-
-
-
-
Field Detail
-
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 Detail
-
DeleteObjectQuery
public DeleteObjectQuery()
-
DeleteObjectQuery
public DeleteObjectQuery(java.lang.Object objectToDelete)
-
DeleteObjectQuery
public DeleteObjectQuery(Call call)
-
-
Method Detail
-
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:
checkForCustomQueryin classDatabaseQuery
-
executeInUnitOfWorkObjectLevelModifyQuery
protected java.lang.Object executeInUnitOfWorkObjectLevelModifyQuery(org.eclipse.persistence.internal.sessions.UnitOfWorkImpl unitOfWork, org.eclipse.persistence.internal.sessions.AbstractRecord translationRow) throws DatabaseException, OptimisticLockExceptionINTERNAL: Code was moved from UnitOfWork.internalExecuteQuery- Overrides:
executeInUnitOfWorkObjectLevelModifyQueryin classObjectLevelModifyQuery- Parameters:
unitOfWork-translationRow-- Returns:
- Throws:
DatabaseExceptionOptimisticLockException
-
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:
getDefaultRedirectorin classDatabaseQuery
-
executeDatabaseQuery
public java.lang.Object executeDatabaseQuery() throws DatabaseException, OptimisticLockExceptionINTERNAL: Perform the work to delete an object.- Specified by:
executeDatabaseQueryin classDatabaseQuery- 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:
isDeleteObjectQueryin classDatabaseQuery
-
setObject
public void setObject(java.lang.Object object)
PUBLIC: (REQUIRED) Set the object required for modification.- Overrides:
setObjectin classObjectLevelModifyQuery
-
shouldUseOptimisticLocking
protected boolean shouldUseOptimisticLocking(java.lang.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:
preparein classObjectLevelModifyQuery
-
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:
prepareCustomQueryin classDatabaseQuery
-
prepareForExecution
public void prepareForExecution() throws QueryExceptionINTERNAL: Prepare the receiver for execution in a session. In particular, verify that the object is not null and contains a valid primary key.- Overrides:
prepareForExecutionin classObjectLevelModifyQuery- Throws:
QueryException
-
-