From 8cf00ad3fd10c322e1190da47f83ba34527b3cd0 Mon Sep 17 00:00:00 2001 From: Sanne Grinovero Date: Tue, 4 Sep 2018 13:35:50 +0100 Subject: [PATCH] HHH-12947 Remove need for BootstrapContext where it's unused --- .../boot/internal/SessionFactoryBuilderImpl.java | 10 +--------- ...DelegatingSessionFactoryBuilderImplementor.java | 6 ------ .../boot/spi/SessionFactoryBuilderImplementor.java | 14 -------------- .../org/hibernate/internal/SessionFactoryImpl.java | 6 ++---- .../SessionFactoryServiceRegistryBuilderImpl.java | 3 --- .../SessionFactoryServiceRegistryFactoryImpl.java | 4 +--- .../SessionFactoryServiceRegistryImpl.java | 12 ------------ .../spi/SessionFactoryServiceInitiatorContext.java | 2 -- .../spi/SessionFactoryServiceRegistryFactory.java | 3 --- .../org/hibernate/type/spi/TypeConfiguration.java | 3 +-- 10 files changed, 5 insertions(+), 58 deletions(-) diff --git a/hibernate-core/src/main/java/org/hibernate/boot/internal/SessionFactoryBuilderImpl.java b/hibernate-core/src/main/java/org/hibernate/boot/internal/SessionFactoryBuilderImpl.java index ffc327962d..1e2e16b4c9 100644 --- a/hibernate-core/src/main/java/org/hibernate/boot/internal/SessionFactoryBuilderImpl.java +++ b/hibernate-core/src/main/java/org/hibernate/boot/internal/SessionFactoryBuilderImpl.java @@ -42,13 +42,10 @@ import org.hibernate.tuple.entity.EntityTuplizerFactory; */ public class SessionFactoryBuilderImpl implements SessionFactoryBuilderImplementor { private final MetadataImplementor metadata; - private final BootstrapContext bootstrapContext; private final SessionFactoryOptionsBuilder optionsBuilder; public SessionFactoryBuilderImpl(MetadataImplementor metadata, BootstrapContext bootstrapContext) { this.metadata = metadata; - this.bootstrapContext = bootstrapContext; - this.optionsBuilder = new SessionFactoryOptionsBuilder( metadata.getMetadataBuildingOptions().getServiceRegistry(), bootstrapContext @@ -436,11 +433,6 @@ public class SessionFactoryBuilderImpl implements SessionFactoryBuilderImplement return this; } - @Override - public void markAsJpaBootstrap() { - this.bootstrapContext.markAsJpaBootstrap(); - } - @Override public void disableRefreshDetachedEntity() { this.optionsBuilder.disableRefreshDetachedEntity(); @@ -464,7 +456,7 @@ public class SessionFactoryBuilderImpl implements SessionFactoryBuilderImplement @Override public SessionFactory build() { metadata.validate(); - return new SessionFactoryImpl( bootstrapContext, metadata, buildSessionFactoryOptions() ); + return new SessionFactoryImpl( metadata, buildSessionFactoryOptions() ); } @Override diff --git a/hibernate-core/src/main/java/org/hibernate/boot/spi/AbstractDelegatingSessionFactoryBuilderImplementor.java b/hibernate-core/src/main/java/org/hibernate/boot/spi/AbstractDelegatingSessionFactoryBuilderImplementor.java index 9e0d6edf71..c0368db831 100644 --- a/hibernate-core/src/main/java/org/hibernate/boot/spi/AbstractDelegatingSessionFactoryBuilderImplementor.java +++ b/hibernate-core/src/main/java/org/hibernate/boot/spi/AbstractDelegatingSessionFactoryBuilderImplementor.java @@ -25,12 +25,6 @@ public abstract class AbstractDelegatingSessionFactoryBuilderImplementor initiators, List providedServices, SessionFactoryImplementor sessionFactory, - BootstrapContext bootstrapContext, SessionFactoryOptions sessionFactoryOptions) { super( parent ); this.sessionFactory = sessionFactory; this.sessionFactoryOptions = sessionFactoryOptions; - this.bootstrapContext = bootstrapContext; // for now, just use the standard initiator list for ( SessionFactoryServiceInitiator initiator : initiators ) { @@ -58,8 +53,6 @@ public class SessionFactoryServiceRegistryImpl for ( ProvidedService providedService : providedServices ) { createServiceBinding( providedService ); } - - bootstrapContext = null; } @Override @@ -75,11 +68,6 @@ public class SessionFactoryServiceRegistryImpl } } - @Override - public BootstrapContext getBootstrapContext() { - return bootstrapContext; - } - @Override public SessionFactoryImplementor getSessionFactory() { return sessionFactory; diff --git a/hibernate-core/src/main/java/org/hibernate/service/spi/SessionFactoryServiceInitiatorContext.java b/hibernate-core/src/main/java/org/hibernate/service/spi/SessionFactoryServiceInitiatorContext.java index 66fb30a0f2..c525a43c06 100644 --- a/hibernate-core/src/main/java/org/hibernate/service/spi/SessionFactoryServiceInitiatorContext.java +++ b/hibernate-core/src/main/java/org/hibernate/service/spi/SessionFactoryServiceInitiatorContext.java @@ -6,7 +6,6 @@ */ package org.hibernate.service.spi; -import org.hibernate.boot.spi.BootstrapContext; import org.hibernate.boot.spi.SessionFactoryOptions; import org.hibernate.engine.spi.SessionFactoryImplementor; @@ -14,7 +13,6 @@ import org.hibernate.engine.spi.SessionFactoryImplementor; * @author Steve Ebersole */ public interface SessionFactoryServiceInitiatorContext { - BootstrapContext getBootstrapContext(); SessionFactoryImplementor getSessionFactory(); SessionFactoryOptions getSessionFactoryOptions(); ServiceRegistryImplementor getServiceRegistry(); diff --git a/hibernate-core/src/main/java/org/hibernate/service/spi/SessionFactoryServiceRegistryFactory.java b/hibernate-core/src/main/java/org/hibernate/service/spi/SessionFactoryServiceRegistryFactory.java index 272cb17ab7..93255868c5 100644 --- a/hibernate-core/src/main/java/org/hibernate/service/spi/SessionFactoryServiceRegistryFactory.java +++ b/hibernate-core/src/main/java/org/hibernate/service/spi/SessionFactoryServiceRegistryFactory.java @@ -6,7 +6,6 @@ */ package org.hibernate.service.spi; -import org.hibernate.boot.spi.BootstrapContext; import org.hibernate.boot.spi.SessionFactoryOptions; import org.hibernate.engine.spi.SessionFactoryImplementor; import org.hibernate.service.Service; @@ -26,14 +25,12 @@ public interface SessionFactoryServiceRegistryFactory extends Service { * for grabbing a reference for later use. However, care should be taken when invoking on * the session factory until after it has been fully initialized. * @param sessionFactoryOptions The build options. - * @param bootstrapContext The (still active) BootstrapContext. * @param sessionFactoryOptions The build options. * * @return The registry */ SessionFactoryServiceRegistry buildServiceRegistry( SessionFactoryImplementor sessionFactory, - BootstrapContext bootstrapContext, SessionFactoryOptions sessionFactoryOptions); } diff --git a/hibernate-core/src/main/java/org/hibernate/type/spi/TypeConfiguration.java b/hibernate-core/src/main/java/org/hibernate/type/spi/TypeConfiguration.java index a27fcf1b59..c8b2bcdf23 100644 --- a/hibernate-core/src/main/java/org/hibernate/type/spi/TypeConfiguration.java +++ b/hibernate-core/src/main/java/org/hibernate/type/spi/TypeConfiguration.java @@ -17,7 +17,6 @@ import org.hibernate.Incubating; import org.hibernate.SessionFactory; import org.hibernate.SessionFactoryObserver; import org.hibernate.boot.cfgxml.spi.CfgXmlAccessService; -import org.hibernate.boot.spi.BootstrapContext; import org.hibernate.boot.spi.MetadataBuildingContext; import org.hibernate.engine.spi.SessionFactoryImplementor; import org.hibernate.id.uuid.LocalObjectUuidHelper; @@ -143,7 +142,7 @@ public class TypeConfiguration implements SessionFactoryObserver, Serializable { scope.setMetadataBuildingContext( metadataBuildingContext ); } - public MetamodelImplementor scope(SessionFactoryImplementor sessionFactory, BootstrapContext bootstrapContext) { + public MetamodelImplementor scope(SessionFactoryImplementor sessionFactory) { log.debugf( "Scoping TypeConfiguration [%s] to SessionFactoryImpl [%s]", this, sessionFactory ); for ( Map.Entry importEntry : scope.metadataBuildingContext.getMetadataCollector().getImports().entrySet() ) {