super.integrate(configuration, sessionFactory, serviceRegistry);
EventListenerRegistry listenerRegistry = serviceRegistry.getService( EventListenerRegistry.class );
listenerRegistry.addDuplicationStrategy( EnversListenerDuplicationStrategy.INSTANCE );
final AuditConfiguration enversConfiguration = AuditConfiguration.getFor( configuration, serviceRegistry.getService( ClassLoaderService.class ) );
if (enversConfiguration.getEntCfg().hasAuditedEntities()) {
listenerRegistry.appendListeners( EventType.POST_DELETE, new EnversOnlyPostDeleteEventListenerImpl( enversConfiguration ) );
}
}
public static class EnversOnlyPostDeleteEventListenerImpl extends EnversPostDeleteEventListenerImpl {
public EnversOnlyPostDeleteEventListenerImpl(AuditConfiguration enversConfiguration) {