Code example for SessionFactoryServiceRegistry

Methods: getService

0
	                      SessionFactoryImplementor sessionFactory,
	                      SessionFactoryServiceRegistry serviceRegistry) {
		super.integrate(configuration, sessionFactory, serviceRegistry);
		AuditContext.enableAudit(); 
		final AuditConfiguration enversConfiguration = AuditConfiguration.getFor(configuration,
				serviceRegistry.getService(ClassLoaderService.class));
 
		EventListenerRegistry listenerRegistry = serviceRegistry.getService(EventListenerRegistry.class);
 
		logger.info("Registering event listeners"); 
		if (enversConfiguration.getEntCfg().hasAuditedEntities()) {
			listenerRegistry.appendListeners(EventType.POST_DELETE, new DeleteEnversListener(enversConfiguration));
			listenerRegistry.appendListeners(EventType.POST_INSERT, new InsertEnversListener(enversConfiguration));
			listenerRegistry.appendListeners(EventType.POST_UPDATE, new UpdateEnversListerner(enversConfiguration));
			listenerRegistry.appendListeners(EventType.POST_COLLECTION_RECREATE, new CollectionRecreateEnversListener(enversConfiguration));
			listenerRegistry.appendListeners(EventType.PRE_COLLECTION_REMOVE, new PreCollectionRemoveEnversListener(enversConfiguration));
			listenerRegistry.appendListeners(EventType.PRE_COLLECTION_UPDATE, new PreCollectionUpdateEnversListener(enversConfiguration));
		} 
	} 
} 
Experience pair programming with AI  Get Codota for Java