java.lang.Object
org.seasar.doma.jdbc.query.AbstractQuery
org.seasar.doma.jdbc.query.AutoModifyQuery<ENTITY>
org.seasar.doma.jdbc.query.AutoDeleteQuery<ENTITY>
- Type Parameters:
ENTITY- the entity type
- All Implemented Interfaces:
DeleteQuery,ModifyQuery,Query
An auto delete query that is executed against an entity class.
This class implements DeleteQuery to provide DELETE operations for entities. It
handles version checking for optimistic locking and supports tenant ID-based isolation.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprotected static classContext class for post-delete operations.protected static classContext class for pre-delete operations. -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected 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.AutoModifyQuery
autoGeneratedKeysSupported, EMPTY_STRINGS, entity, entityType, excludedPropertyNames, executable, idPropertyTypes, includedPropertyNames, optimisticLockCheckRequired, returning, sql, sqlExecutionSkipCause, sqlLogType, targetPropertyTypes, tenantIdPropertyType, versionPropertyTypeFields inherited from class org.seasar.doma.jdbc.query.AbstractQuery
callerClassName, callerMethodName, config, message, method, queryTimeout -
Constructor Summary
ConstructorsConstructorDescriptionAutoDeleteQuery(EntityType<ENTITY> entityType) Creates a new instance with the specified entity type. -
Method Summary
Modifier and TypeMethodDescriptionvoidcomplete()Completes this query after execution.protected voidPerforms post-delete operations on the entity.protected voidPerforms pre-delete operations on the entity.voidprepare()Prepares this query for execution.protected voidPrepares optimistic locking for this query.protected voidPrepares the SQL statement 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.AutoModifyQuery
getEntity, getSql, getSqlExecutionSkipCause, getSqlLogType, isAutoGeneratedKeysSupported, isExecutable, isOptimisticLockCheckRequired, isTargetPropertyName, prepareOptions, prepareSpecialPropertyTypes, setEntity, setExcludedPropertyNames, setIncludedPropertyNames, setReturning, setSqlLogType, toString, validateIdExistentMethods inherited from class org.seasar.doma.jdbc.query.AbstractQuery
comment, getClassName, getConfig, 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.ModifyQuery
getSql, getSqlExecutionSkipCause, getSqlLogType, isAutoGeneratedKeysSupported, isExecutable, isOptimisticLockCheckRequiredMethods inherited from interface org.seasar.doma.jdbc.query.Query
comment, getClassName, getConfig, getMethod, getMethodName, getQueryTimeout
-
Field Details
-
versionIgnored
protected boolean versionIgnoredWhether to ignore the version property for optimistic locking. -
optimisticLockExceptionSuppressed
protected boolean optimisticLockExceptionSuppressedWhether to suppress optimistic lock exceptions.
-
-
Constructor Details
-
AutoDeleteQuery
Creates a new instance with the specified entity type.- Parameters:
entityType- the entity type
-
-
Method Details
-
prepare
public void prepare()Prepares this query for execution.This method performs basic preparation steps and validates that the dialect supports returning properties if they are specified.
Subclasses should override this method to perform additional preparation steps, but must call
super.prepare()first.This implementation prepares the query for execution by performing pre-delete operations, preparing special property types, validating ID existence, preparing options and optimistic locking, and building the SQL statement.
- Specified by:
preparein interfaceQuery- Overrides:
preparein classAutoModifyQuery<ENTITY>
-
preDelete
protected void preDelete()Performs pre-delete operations on the entity. This method is called before the entity is deleted from the database. -
prepareOptimisticLock
protected void prepareOptimisticLock()Prepares optimistic locking for this query. If a version property exists and is not ignored, optimistic lock checking will be enabled unless it is explicitly suppressed. -
prepareSql
protected void prepareSql()Prepares the SQL statement for this query. This method builds a DELETE statement using the entity type and its properties. -
complete
public void complete()Completes this query after execution. This method must be called after the query is executed.This implementation performs post-delete operations on the entity.
-
postDelete
protected void postDelete()Performs post-delete operations on the entity. This method is called after the entity is deleted from the database. -
setVersionIgnored
public void setVersionIgnored(boolean versionIgnored) Sets whether to ignore the version property for optimistic locking.- Parameters:
versionIgnored-trueto ignore the version property
-
setOptimisticLockExceptionSuppressed
public void setOptimisticLockExceptionSuppressed(boolean optimisticLockExceptionSuppressed) Sets whether to suppress optimistic lock exceptions.- Parameters:
optimisticLockExceptionSuppressed-trueto suppress optimistic lock exceptions
-