Class SqlFileBatchDeleteQuery<ELEMENT>
- Type Parameters:
ELEMENT- the type of elements in the batch
- All Implemented Interfaces:
BatchDeleteQuery,BatchModifyQuery,Query
This class extends SqlFileBatchModifyQuery to provide functionality for executing
batch DELETE statements defined in external SQL files. It handles entity lifecycle callbacks,
optimistic locking, and SQL file execution for multiple entities.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprotected classA handler for entity lifecycle callbacks and optimistic locking.protected static classA context for post-delete entity lifecycle callbacks.protected static classA context for pre-delete entity lifecycle callbacks. -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected SqlFileBatchDeleteQuery<ELEMENT>.EntityHandlerThe entity handler for this query.protected booleanWhether to suppress optimistic lock exceptions.protected booleanWhether to ignore the version property for optimistic locking.Fields inherited from class org.seasar.doma.jdbc.query.SqlFileBatchModifyQuery
batchSize, currentEntity, elementClass, elements, EMPTY_STRINGS, excludedPropertyNames, executable, includedPropertyNames, kind, optimisticLockCheckRequired, parameterName, sqlExecutionSkipCause, sqlFile, sqlFilePath, sqlLogType, sqlsFields inherited from class org.seasar.doma.jdbc.query.AbstractQuery
callerClassName, callerMethodName, config, message, method, queryTimeout -
Constructor Summary
ConstructorsConstructorDescriptionSqlFileBatchDeleteQuery(Class<ELEMENT> elementClass) Constructs a new instance with the specified element class. -
Method Summary
Modifier and TypeMethodDescriptionvoidcomplete()Completes this query after execution.protected voidExecutes pre-delete entity lifecycle callbacks.voidprepare()Prepares this query for execution.protected voidPrepares optimistic locking for this query.voidsetEntityType(EntityType<ELEMENT> entityType) Sets the entity type for this query.voidsetOptimisticLockExceptionSuppressed(boolean optimisticLockExceptionSuppressed) Sets whether to suppress optimistic lock exceptions.voidsetVersionIgnored(boolean versionIgnored) Sets whether to ignore the version property for optimistic locking.Methods inherited from class org.seasar.doma.jdbc.query.SqlFileBatchModifyQuery
expandColumns, getBatchSize, getConfig, getEntities, getSql, getSqlExecutionSkipCause, getSqlLogType, getSqls, isAutoGeneratedKeysSupported, isExecutable, isOptimisticLockCheckRequired, populateValues, prepareOptions, prepareSql, prepareSqlFile, setBatchSize, setElements, setExcludedPropertyNames, setIncludedPropertyNames, setParameterName, setSqlFilePath, setSqlLogType, toStringMethods inherited from class org.seasar.doma.jdbc.query.AbstractQuery
comment, getClassName, getMethod, getMethodName, getQueryTimeout, setCallerClassName, setCallerMethodName, setConfig, setMessage, setMethod, setQueryTimeoutMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface org.seasar.doma.jdbc.query.BatchModifyQuery
getBatchSize, getSql, getSqlExecutionSkipCause, getSqlLogType, getSqls, isAutoGeneratedKeysSupported, isExecutable, isOptimisticLockCheckRequiredMethods inherited from interface org.seasar.doma.jdbc.query.Query
comment, getClassName, getConfig, getMethod, getMethodName, getQueryTimeout
-
Field Details
-
entityHandler
The entity handler for this query. -
versionIgnored
protected boolean versionIgnoredWhether to ignore the version property for optimistic locking. -
optimisticLockExceptionSuppressed
protected boolean optimisticLockExceptionSuppressedWhether to suppress optimistic lock exceptions.
-
-
Constructor Details
-
SqlFileBatchDeleteQuery
Constructs a new instance with the specified element class.- Parameters:
elementClass- the class of elements in the batch
-
-
Method Details
-
prepare
public void prepare()Prepares this query for execution. This method must be called before the query is executed.This implementation validates that required components are not null.
This implementation prepares the SQL statements for each entity in the batch, executing pre-delete callbacks and optimistic lock preparation.
- Specified by:
preparein interfaceQuery- Overrides:
preparein classSqlFileBatchModifyQuery<ELEMENT>
-
preDelete
protected void preDelete()Executes pre-delete entity lifecycle callbacks.This method delegates to the entity handler if one is available.
-
prepareOptimisticLock
protected void prepareOptimisticLock()Prepares optimistic locking for this query.This method delegates to the entity handler if one is available.
-
complete
public void complete()Completes this query after execution. This method must be called after the query is executed.This implementation executes post-delete entity lifecycle callbacks for each entity in the batch.
-
setEntityType
Sets the entity type for this query.This implementation creates an entity handler for the specified entity type.
- Specified by:
setEntityTypein classSqlFileBatchModifyQuery<ELEMENT>- Parameters:
entityType- the entity type
-
setVersionIgnored
public void setVersionIgnored(boolean versionIgnored) Sets whether to ignore the version property for optimistic locking.- Parameters:
versionIgnored- whether to ignore the version property
-
setOptimisticLockExceptionSuppressed
public void setOptimisticLockExceptionSuppressed(boolean optimisticLockExceptionSuppressed) Sets whether to suppress optimistic lock exceptions.- Parameters:
optimisticLockExceptionSuppressed- whether to suppress optimistic lock exceptions
-