@Override public void addObserver(SessionFactoryObserver observer) { delegate.addObserver( observer ); }
public MetamodelImplementor scope(SessionFactoryImplementor sessionFactory) { log.debugf( "Scoping TypeConfiguration [%s] to SessionFactoryImpl [%s]", this, sessionFactory ); for ( Map.Entry<String, String> importEntry : scope.metadataBuildingContext.getMetadataCollector().getImports().entrySet() ) { if ( importMap.containsKey( importEntry.getKey() ) ) { continue; } importMap.put( importEntry.getKey(), importEntry.getValue() ); } scope.setSessionFactory( sessionFactory ); sessionFactory.addObserver( this ); return new MetamodelImpl( sessionFactory, this ); }
@Override public void addObserver(SessionFactoryObserver observer) { delegate.addObserver( observer ); }
public class FlywayIntegrator implements Integrator { @Override public void integrate(Configuration c, SessionFactoryImplementor sfi, SessionFactoryServiceRegistry sfsr) { sfi.addObserver( new SessionFactoryObserver() { @Override public void sessionFactoryCreated(SessionFactory factory) { //now, after schema-export, flyway migration... } @Override public void sessionFactoryClosed(SessionFactory factory) { } } ); } //... other methods }
private void doIntegrate(Metadata metadata, SessionFactoryImplementor sessionFactory, SessionFactoryServiceRegistry serviceRegistry) { if ( ! serviceRegistry.getService( OgmConfigurationService.class ).isOgmEnabled() ) { return; } Version.touch(); sessionFactory.addObserver( new SchemaDefiningObserver( metadata ) ); sessionFactory.addObserver( new SessionFactoryLifecycleAwareDialectInitializer() ); attachEventContextManagingListenersIfRequired( serviceRegistry ); }
public MetamodelImplementor scope(SessionFactoryImplementor sessionFactory, BootstrapContext bootstrapContext) { assert scope.metadataBuildingContext != null; log.debugf( "Scoping TypeConfiguration [%s] to SessionFactoryImpl [%s]", this, sessionFactory ); scope.setSessionFactory( sessionFactory ); sessionFactory.addObserver( this ); log.debugf( "Scoping TypeConfiguration [%s] to SessionFactory [%s]", this, sessionFactory ); return RuntimeModelCreationProcess.execute( sessionFactory, bootstrapContext, scope.getMetadataBuildingContext() ); }
databaseModel, sessionFactory.getServiceRegistry(), action -> sessionFactory.addObserver( action ) );
@Override public void integrate(Metadata metadata, SessionFactoryImplementor sessionFactory, SessionFactoryServiceRegistry serviceRegistry) { ConfigurationService configurationService = serviceRegistry.getService( ConfigurationService.class ); JndiService namingService = serviceRegistry.getService( JndiService.class ); if ( ! hibernateSearchNeedsToBeEnabled( configurationService ) ) { return; } FullTextIndexEventListener fullTextIndexEventListener = new FullTextIndexEventListener(); registerHibernateSearchEventListener( fullTextIndexEventListener, serviceRegistry ); ClassLoaderService hibernateOrmClassLoaderService = serviceRegistry.getService( ClassLoaderService.class ); ServiceBinding<EnvironmentSynchronizer> environmentSynchronizerBinding = serviceRegistry.locateServiceBinding( EnvironmentSynchronizer.class ); ServiceBinding<ManagedBeanRegistry> managedBeanRegistryServiceBinding = serviceRegistry.locateServiceBinding( ManagedBeanRegistry.class ); HibernateSearchSessionFactoryObserver observer = new HibernateSearchSessionFactoryObserver( metadata, configurationService, fullTextIndexEventListener, hibernateOrmClassLoaderService, environmentSynchronizerBinding == null ? null : serviceRegistry.getService( EnvironmentSynchronizer.class ), managedBeanRegistryServiceBinding == null ? null : serviceRegistry.getService( ManagedBeanRegistry.class ), namingService ); sessionFactory.addObserver( observer ); }
@SuppressWarnings("unchecked") private void assertObserverCalledAndEventListenersRegistered() { Capture<SessionFactoryObserver> capturedSessionFactoryObserver = newCapture(); mockSessionFactoryImplementor.addObserver( EasyMock.and( EasyMock.capture( capturedSessionFactoryObserver ),
); sessionFactory.addObserver( observer );