|
EclipseLink 2.5.0, build 'v20130507-3faac2b' 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.ModifyQuery
org.eclipse.persistence.queries.ModifyAllQuery
org.eclipse.persistence.queries.DeleteAllQuery
public class DeleteAllQuery
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:
| Nested Class Summary |
|---|
| Nested classes/interfaces inherited from class org.eclipse.persistence.queries.DatabaseQuery |
|---|
DatabaseQuery.ParameterType |
| Field Summary | |
|---|---|
protected boolean |
isInMemoryOnly
Defines if objects should be remove from the persistence context only (no database). |
protected java.util.List<java.lang.Object> |
objects
List containing objects to be deleted, these should be removed from the identity map after deletion. |
| Fields inherited from class org.eclipse.persistence.queries.ModifyAllQuery |
|---|
defaultBuilder, INVALIDATE_CACHE, isPreparedUsingTempStorage, NO_CACHE, referenceClass, referenceClassName, result |
| Fields inherited from class org.eclipse.persistence.queries.ModifyQuery |
|---|
forceBatchStatementExecution, isBatchExecutionSupported, modifyRow |
| Constructor Summary | |
|---|---|
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. |
|
| Method Summary | |
|---|---|
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. |
protected QueryRedirector |
getDefaultRedirector()
INTERNAL: Returns the specific default redirector for this query type. |
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). |
protected void |
prepare()
INTERNAL: Prepare the receiver for execution in a session. |
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. |
| Methods inherited from class org.eclipse.persistence.queries.ModifyQuery |
|---|
forceBatchStatementExecution, getModifyRow, isBatchExecutionSupported, isModifyQuery, setForceBatchStatementExecution, setIsBatchExecutionSupported, setModifyRow |
| Methods inherited from class java.lang.Object |
|---|
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
protected java.util.List<java.lang.Object> objects
protected boolean isInMemoryOnly
| Constructor Detail |
|---|
public DeleteAllQuery()
public DeleteAllQuery(java.lang.Class referenceClass)
public DeleteAllQuery(java.lang.Class referenceClass,
Expression selectionCriteria)
| Method Detail |
|---|
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 arguments
DatabaseException - - 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
DatabaseExceptionprotected QueryRedirector getDefaultRedirector()
getDefaultRedirector in class DatabaseQuerypublic java.util.List<java.lang.Object> getObjects()
protected void prepare()
throws QueryException
prepare in class DatabaseQueryQueryExceptionpublic 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.
|
EclipseLink 2.5.0, build 'v20130507-3faac2b' API Reference | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||