a couple of small optimizations to writing Integrators

default impls for:

- Integrator.disintegrate()
- PostActionEventListener.requiresPostCommitHandling()

Signed-off-by: Gavin King <gavin@hibernate.org>
This commit is contained in:
Gavin King 2024-05-09 22:06:45 +02:00 committed by Steve Ebersole
parent 20bc303ca6
commit fd30841c33
3 changed files with 6 additions and 7 deletions

View File

@ -20,5 +20,7 @@ interface PostActionEventListener {
*
* @return {@code true} if after transaction callbacks should be added.
*/
boolean requiresPostCommitHandling(EntityPersister persister);
default boolean requiresPostCommitHandling(EntityPersister persister) {
return false;
}
}

View File

@ -71,6 +71,8 @@ public interface Integrator {
* @param sessionFactory The session factory being closed.
* @param serviceRegistry That session factory's service registry
*/
void disintegrate(SessionFactoryImplementor sessionFactory, SessionFactoryServiceRegistry serviceRegistry);
default void disintegrate(SessionFactoryImplementor sessionFactory, SessionFactoryServiceRegistry serviceRegistry) {
// do nothing by default
}
}

View File

@ -53,11 +53,6 @@ public class LoadEntityWithElementCollectionTest {
isPostUpdateCalled = true;
}
@Override
public boolean requiresPostCommitHandling(EntityPersister persister) {
return false;
}
public boolean isPostUpdateCalled() {
return isPostUpdateCalled;
}