- Type Parameters:
E- the entity type that was deleted
- All Known Implementing Classes:
AbstractPostDeleteContext,AutoBatchDeleteQuery.AutoBatchPostDeleteContext,AutoDeleteQuery.AutoPostDeleteContext,SqlFileBatchDeleteQuery.SqlFileBatchPostDeleteContext,SqlFileDeleteQuery.SqlFilePostDeleteContext
This interface provides methods to access and modify the entity that was 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 after a delete operation.
The context is passed to the postDelete 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 that was deleted.Returns the DAO method that is annotated withDeleteand triggered this delete operation.Returns the entity instance that was deleted.default ReturningPropertiesReturns the returning properties configuration for this delete operation.voidsetNewEntity(E newEntity) Sets a new entity instance to be used after the delete operation.
-
Method Details
-
getEntityType
EntityType<E> getEntityType()Returns the entity type metadata for the entity that was 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 was deleted.This is the entity instance after the delete operation and any modifications made by entity listeners in their postDelete methods.
- Returns:
- the deleted entity instance
-
setNewEntity
Sets a new entity instance to be used after the delete operation.This method is primarily used with immutable entity classes, allowing entity listeners to replace the entity instance with a modified version after it has been 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:
-