Package de.xima.fc.annotations
Interface EntityMigrationSettings.CustomEncryptionMigrator<T>
-
- Type Parameters:
T
- The type of the entity to migrate.
- Enclosing class:
- EntityMigrationSettings
public static interface EntityMigrationSettings.CustomEncryptionMigrator<T>
A custom migrator to apply to each instance of an entity to migrate. Can be used to perform custom business logic during the migration process.- Since:
- 8.3.7
-
-
Method Summary
All Methods Instance Methods Default Methods Modifier and Type Method Description default T
onEntityRead(javax.persistence.EntityManager em, T entity)
Invoked just after the entity was read from the database, but before any changes are made to it.default void
onEntityUpdated(javax.persistence.EntityManager em, Object id)
Invoked just after the entity was written back to the database.
-
-
-
Method Detail
-
onEntityRead
default T onEntityRead(javax.persistence.EntityManager em, T entity)
Invoked just after the entity was read from the database, but before any changes are made to it. Can be used e.g. to update some entity fields etc. If needed, you can return a different entity instance. If you return null, the entity that was passed into this method will be used. You do not need to write the entity back to the database, this will be done later by the migration process. However, if you do update the entity in this method, you must return the updated entity instance.- Parameters:
em
- The entity manager for interacting with the database.entity
- The entity instance that was read from the database.- Returns:
- The entity instance to use for further processing, or null to use the original entity instance.
- Throws:
RuntimeException
- If thrown, aborts the migration process for the current entity, logs an error, and proceeds with the next entity.
-
onEntityUpdated
default void onEntityUpdated(javax.persistence.EntityManager em, Object id)
Invoked just after the entity was written back to the database. Can be used to perform any additional logic that is needed. This method is passed only the ID of the entity, if you must perform any additional actions, you must first read the entity from the database. If you make any changes to the entity, you must also write the entity back to the database.- Parameters:
em
- The entity manager for interacting with the database.id
- The ID of the entity instance that was written back to the database.- Throws:
RuntimeException
- If thrown, aborts the migration process for the current entity, logs an error, and proceeds with the next entity.
-
-