public class DeleteAllQuery extends ModifyAllQuery
Purpose: Query used to delete a collection of objects. This is used by mappings to delete all of their target objects in a single database call. The SQL/SQLStatements must be provided.
DeleteAll can also be used with an Expression (or JPQL) to dynamically delete a set of objects from the database, and invalidate them in the cache.
Responsibilities:
DatabaseQuery.ParameterTypeINVALIDATE_CACHE, NO_CACHEBATCH_FETCH_PROPERTY, CascadeAggregateDelete, CascadeAllParts, CascadeByMapping, CascadeDependentParts, CascadePrivateParts, NoCascading| Constructor and Description |
|---|
DeleteAllQuery()
PUBLIC:
|
DeleteAllQuery(java.lang.Class referenceClass)
PUBLIC: Create a new delete all query for the class specified.
|
DeleteAllQuery(java.lang.Class referenceClass, Expression selectionCriteria)
PUBLIC: Create a new delete all query for the class and the selection criteria specified.
|
| Modifier and Type | Method and Description |
|---|---|
java.lang.Object |
executeDatabaseQuery()
INTERNAL: Perform the work to delete a collection of objects.
|
void |
executeDeleteAll(org.eclipse.persistence.internal.sessions.AbstractSession session, org.eclipse.persistence.internal.sessions.AbstractRecord translationRow, java.util.Vector objects)
INTERNAL: Delete all queries are executed specially to avoid cloning and ensure preparing.
|
java.lang.Object |
executeInUnitOfWork(org.eclipse.persistence.internal.sessions.UnitOfWorkImpl unitOfWork, org.eclipse.persistence.internal.sessions.AbstractRecord translationRow)
INTERNAL: This method has to be broken.
|
java.util.List<java.lang.Object> |
getObjects()
PUBLIC: Return the objects that are to be deleted
|
boolean |
isDeleteAllQuery()
PUBLIC: Return if this is a delete all query.
|
boolean |
isInMemoryOnly()
INTERNAL: Return if objects should be remove from the persistence context only (no database).
|
void |
setIsInMemoryOnly(boolean isInMemoryOnly)
INTERNAL: Set if objects should be remove from the persistence context only (no database).
|
void |
setObjects(java.util.List<java.lang.Object> objectCollection)
PUBLIC (REQUIRED): Set the objects to be deleted.
|
getCacheUsage, getExpressionBuilder, getReferenceClass, getReferenceClassName, isModifyAllQuery, isPreparedUsingTempStorage, mergeChangesIntoSharedCache, setCacheUsage, setExpressionBuilder, setIsPreparedUsingTempStorage, setReferenceClass, setReferenceClassName, setShouldDeferExecutionInUOW, shouldDeferExecutionInUOWforceBatchStatementExecution, getModifyRow, isBatchExecutionSupported, isModifyQuery, setForceBatchStatementExecution, setIsBatchExecutionSupported, setModifyRowaddArgument, addArgument, addArgument, addArgument, addArgument, addArgument, addArgumentByTypeName, addArgumentValue, addArgumentValues, addCall, addStatement, bindAllParameters, buildArgumentFields, cacheStatement, cascadeAllParts, cascadeByMapping, cascadeOnlyDependentParts, cascadePrivateParts, checkDescriptor, checkEarlyReturn, checkPrepare, checkPrepare, clone, 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, 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, isDataModifyQuery, isDataReadQuery, isDefaultPropertiesQuery, isDeleteObjectQuery, isDirectReadQuery, isExecutionClone, isExpressionQuery, isInsertObjectQuery, isJPQLCallQuery, isNativeConnectionRequired, isObjectBuildingQuery, isObjectLevelModifyQuery, isObjectLevelReadQuery, isPrepared, isReadAllQuery, isReadObjectQuery, isReadQuery, isReportQuery, isResultSetMappingQuery, isSQLCallQuery, isUpdateAllQuery, isUpdateObjectQuery, isUserDefined, isUserDefinedSQLCall, isValueReadQuery, isWriteObjectQuery, maintainCache, prepareCall, prepareForExecution, prepareFromQuery, prepareInternal, redirectQuery, remoteExecute, removeProperty, replaceValueHoldersIn, resetMonitorName, retrieveBypassCache, rowFromArguments, setAccessor, setAccessors, setAllowNativeSQLQuery, setArguments, setArgumentTypeNames, setArgumentTypes, setArgumentValues, setBatchObjects, setCall, setCascadePolicy, setDatasourceCall, setDescriptor, setDoNotRedirect, setEJBQLString, setFlushOnExecute, setHintString, setIsExecutionClone, setIsNativeConnectionRequired, setIsPrepared, setIsUserDefined, setIsUserDefinedSQLCall, setJPQLString, setName, setNullableArguments, setParameterDelimiter, setPartitioningPolicy, setProperties, setProperty, setQueryTimeout, setRedirector, setSelectionCriteria, setSession, setSessionName, setShouldBindAllParameters, setShouldBindAllParameters, setShouldCacheStatement, setShouldMaintainCache, setShouldPrepare, setShouldRetrieveBypassCache, setShouldStoreBypassCache, setShouldUseWrapperPolicy, setShouldValidateUpdateCallCacheUse, setSourceMapping, setSQLStatement, setSQLString, setTranslationRow, shouldAllowNativeSQLQuery, shouldBindAllParameters, shouldCacheStatement, shouldCascadeAllParts, shouldCascadeByMapping, shouldCascadeOnlyDependentParts, shouldCascadeParts, shouldCascadePrivateParts, shouldCloneCall, shouldIgnoreBindAllParameters, shouldIgnoreCacheStatement, shouldMaintainCache, shouldPrepare, shouldPrepare, shouldRetrieveBypassCache, shouldStoreBypassCache, shouldUseWrapperPolicy, shouldValidateUpdateCallCacheUse, storeBypassCache, toStringpublic DeleteAllQuery()
public DeleteAllQuery(java.lang.Class referenceClass)
public DeleteAllQuery(java.lang.Class referenceClass,
Expression selectionCriteria)
public boolean isInMemoryOnly()
public void setIsInMemoryOnly(boolean isInMemoryOnly)
public boolean isDeleteAllQuery()
isDeleteAllQuery in class DatabaseQuery
public java.lang.Object executeInUnitOfWork(org.eclipse.persistence.internal.sessions.UnitOfWorkImpl unitOfWork,
org.eclipse.persistence.internal.sessions.AbstractRecord translationRow)
throws DatabaseException
executeInUnitOfWork in class ModifyAllQueryunitOfWork - - the session in which the receiver will be executed.translationRow - - the argumentsDatabaseException - - an error has occurred on the database.
public java.lang.Object executeDatabaseQuery()
throws DatabaseException
executeDatabaseQuery in class DatabaseQueryDatabaseException - - an error has occurred on the database.
public void executeDeleteAll(org.eclipse.persistence.internal.sessions.AbstractSession session,
org.eclipse.persistence.internal.sessions.AbstractRecord translationRow,
java.util.Vector objects)
throws DatabaseException
DatabaseExceptionpublic java.util.List<java.lang.Object> getObjects()
public void setObjects(java.util.List<java.lang.Object> objectCollection)
List objects used as an indicator of one of two possible ways the query may behave:
objects != null - the "old" functionality used by OneToMany mapping objects deleted from the cache, either selection expression or custom sql should be provided for deletion from db;
objects == null - the "new" functionality (on par with UpdateAllQuery) the cache is either left alone or in-memory query finds the cached objects to be deleted, and these objects are invalidated in cache.
Note that empty objects is still objects != case. Signal that no cache altering is required. Used by AggregationCollectionMapping and OneToManyMapping in case they use indirection and the ValueHolder has not been instantiated.