- All Implemented Interfaces:
DeleteQuery,ModifyQuery,Query
This class extends SqlFileModifyQuery to provide functionality for executing DELETE
statements defined in external SQL files. It handles entity lifecycle callbacks, optimistic
locking, and SQL file execution.
-
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 SqlFileDeleteQuery.EntityHandler<?>The 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.SqlFileModifyQuery
EMPTY_STRINGS, excludedPropertyNames, executable, includedPropertyNames, kind, optimisticLockCheckRequired, parameters, sql, sqlExecutionSkipCause, sqlFilePath, sqlLogTypeFields inherited from class org.seasar.doma.jdbc.query.AbstractQuery
callerClassName, callerMethodName, config, message, method, queryTimeout -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidcomplete()Completes this query after execution.<E> EReturns the entity associated with this query.protected voidExecutes pre-delete entity lifecycle callbacks.voidprepare()Prepares this query for execution.protected voidPrepares the executable state for this query.protected voidPrepares optimistic locking for this query.<E> voidsetEntityAndEntityType(String name, E entity, EntityType<E> entityType) Sets the entity and 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.SqlFileModifyQuery
addParameter, addParameterInternal, expandColumns, getSql, getSqlExecutionSkipCause, getSqlLogType, isAutoGeneratedKeysSupported, isExecutable, isOptimisticLockCheckRequired, populateValues, prepareOptions, prepareSql, setExcludedPropertyNames, setIncludedPropertyNames, setSqlFilePath, setSqlLogType, toStringMethods 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
-
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
-
SqlFileDeleteQuery
public SqlFileDeleteQuery()Constructs a new instance.This constructor initializes the query with
SqlKind.DELETEto indicate that it performs a DELETE operation.
-
-
Method Details
-
prepare
public void prepare()Prepares this query for execution. This method must be called before the query is executed.This implementation prepares the SQL statement by processing the SQL file and handling entity lifecycle callbacks and optimistic locking.
- Specified by:
preparein interfaceQuery- Overrides:
preparein classAbstractQuery
-
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.
-
prepareExecutable
protected void prepareExecutable()Prepares the executable state for this query.This method sets the query as executable and clears any skip cause.
-
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.
-
setEntityAndEntityType
Sets the entity and entity type for this query.This implementation creates an entity handler for the specified entity.
- Specified by:
setEntityAndEntityTypein classSqlFileModifyQuery- Type Parameters:
E- the entity type- Parameters:
name- the parameter name for the entityentity- the entityentityType- 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
-
getEntity
Returns the entity associated with this query.- Type Parameters:
E- the entity type- Parameters:
entityType- the entity class- Returns:
- the entity, or null if no entity is associated with this query
-