- Type Parameters:
E- the entity type being deleted
- All Known Implementing Classes:
AbstractPreDeleteContext,AutoBatchDeleteQuery.AutoBatchPreDeleteContext,AutoDeleteQuery.AutoPreDeleteContext,SqlFileBatchDeleteQuery.SqlFileBatchPreDeleteContext,SqlFileDeleteQuery.SqlFilePreDeleteContext
This interface provides methods to access and modify the entity being deleted, as well as methods to access configuration and metadata about the delete operation. It is typically used in entity listener implementations to perform custom logic before a delete operation.
The context is passed to the preDelete method of entity listeners.
-
Method Summary
Modifier and TypeMethodDescriptionReturns the Doma configuration associated with this delete operation.Returns the entity type metadata for the entity being deleted.Returns the DAO method that is annotated withDeleteand triggered this delete operation.Returns the entity instance that is about to be deleted.default ReturningPropertiesReturns the returning properties configuration for this delete operation.voidsetNewEntity(E newEntity) Sets a new entity instance to be used for the delete operation.
-
Method Details
-
getEntityType
EntityType<E> getEntityType()Returns the entity type metadata for the entity being deleted.The entity type provides access to metadata about the entity class, including its properties, naming conventions, and other configuration.
- Returns:
- the entity type metadata
-
getMethod
Method getMethod()Returns the DAO method that is annotated withDeleteand triggered this delete operation.This method provides access to the reflection Method object representing the DAO method that initiated the delete operation.
- Returns:
- the Method object representing the DAO method
-
getConfig
Config getConfig()Returns the Doma configuration associated with this delete operation.The configuration provides access to database connection, dialect, and other runtime settings for the current operation.
- Returns:
- the Doma configuration
-
getNewEntity
E getNewEntity()Returns the entity instance that is about to be deleted.This is the entity instance before any modifications made by entity listeners in their preDelete methods.
- Returns:
- the entity instance to be deleted
-
setNewEntity
Sets a new entity instance to be used for the delete operation.This method is primarily used with immutable entity classes, allowing entity listeners to replace the entity instance with a modified version before it is deleted from the database.
- Parameters:
newEntity- the new entity instance to use- Throws:
DomaNullPointerException- ifnewEntityisnull
-
getReturningProperties
Returns the returning properties configuration for this delete operation.Returning properties specify which columns should be returned by the database after a delete operation, typically used with the RETURNING clause in SQL.
- Returns:
- the returning properties configuration, never
null - See Also:
-