HHH-12947 Remove need for BootstrapContext where it's unused
This commit is contained in:
parent
b3c2c2fe47
commit
8cf00ad3fd
|
@ -42,13 +42,10 @@ import org.hibernate.tuple.entity.EntityTuplizerFactory;
|
||||||
*/
|
*/
|
||||||
public class SessionFactoryBuilderImpl implements SessionFactoryBuilderImplementor {
|
public class SessionFactoryBuilderImpl implements SessionFactoryBuilderImplementor {
|
||||||
private final MetadataImplementor metadata;
|
private final MetadataImplementor metadata;
|
||||||
private final BootstrapContext bootstrapContext;
|
|
||||||
private final SessionFactoryOptionsBuilder optionsBuilder;
|
private final SessionFactoryOptionsBuilder optionsBuilder;
|
||||||
|
|
||||||
public SessionFactoryBuilderImpl(MetadataImplementor metadata, BootstrapContext bootstrapContext) {
|
public SessionFactoryBuilderImpl(MetadataImplementor metadata, BootstrapContext bootstrapContext) {
|
||||||
this.metadata = metadata;
|
this.metadata = metadata;
|
||||||
this.bootstrapContext = bootstrapContext;
|
|
||||||
|
|
||||||
this.optionsBuilder = new SessionFactoryOptionsBuilder(
|
this.optionsBuilder = new SessionFactoryOptionsBuilder(
|
||||||
metadata.getMetadataBuildingOptions().getServiceRegistry(),
|
metadata.getMetadataBuildingOptions().getServiceRegistry(),
|
||||||
bootstrapContext
|
bootstrapContext
|
||||||
|
@ -436,11 +433,6 @@ public class SessionFactoryBuilderImpl implements SessionFactoryBuilderImplement
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void markAsJpaBootstrap() {
|
|
||||||
this.bootstrapContext.markAsJpaBootstrap();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void disableRefreshDetachedEntity() {
|
public void disableRefreshDetachedEntity() {
|
||||||
this.optionsBuilder.disableRefreshDetachedEntity();
|
this.optionsBuilder.disableRefreshDetachedEntity();
|
||||||
|
@ -464,7 +456,7 @@ public class SessionFactoryBuilderImpl implements SessionFactoryBuilderImplement
|
||||||
@Override
|
@Override
|
||||||
public SessionFactory build() {
|
public SessionFactory build() {
|
||||||
metadata.validate();
|
metadata.validate();
|
||||||
return new SessionFactoryImpl( bootstrapContext, metadata, buildSessionFactoryOptions() );
|
return new SessionFactoryImpl( metadata, buildSessionFactoryOptions() );
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -25,12 +25,6 @@ public abstract class AbstractDelegatingSessionFactoryBuilderImplementor<T exten
|
||||||
return (SessionFactoryBuilderImplementor) super.delegate();
|
return (SessionFactoryBuilderImplementor) super.delegate();
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings("deprecation")
|
|
||||||
@Override
|
|
||||||
public void markAsJpaBootstrap() {
|
|
||||||
delegate().markAsJpaBootstrap();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void disableJtaTransactionAccess() {
|
public void disableJtaTransactionAccess() {
|
||||||
delegate().disableJtaTransactionAccess();
|
delegate().disableJtaTransactionAccess();
|
||||||
|
|
|
@ -15,20 +15,6 @@ import org.hibernate.boot.SessionFactoryBuilder;
|
||||||
* @author Steve Ebersole
|
* @author Steve Ebersole
|
||||||
*/
|
*/
|
||||||
public interface SessionFactoryBuilderImplementor extends SessionFactoryBuilder {
|
public interface SessionFactoryBuilderImplementor extends SessionFactoryBuilder {
|
||||||
/**
|
|
||||||
* Indicates that the SessionFactory being built comes from JPA bootstrapping.
|
|
||||||
* Internally {@code false} is the assumed value. We only need to call this to
|
|
||||||
* mark that as true.
|
|
||||||
*
|
|
||||||
* @deprecated (since 5.2) In fact added in 5.2 as part of consolidating JPA support
|
|
||||||
* directly into Hibernate contracts (SessionFactory, Session); intended to provide
|
|
||||||
* transition help in cases where we need to know the difference in JPA/native use for
|
|
||||||
* various reasons.
|
|
||||||
* Use {@link BootstrapContext#markAsJpaBootstrap()}
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
@Deprecated
|
|
||||||
void markAsJpaBootstrap();
|
|
||||||
|
|
||||||
void disableJtaTransactionAccess();
|
void disableJtaTransactionAccess();
|
||||||
|
|
||||||
|
|
|
@ -50,7 +50,6 @@ import org.hibernate.TypeHelper;
|
||||||
import org.hibernate.boot.cfgxml.spi.CfgXmlAccessService;
|
import org.hibernate.boot.cfgxml.spi.CfgXmlAccessService;
|
||||||
import org.hibernate.boot.cfgxml.spi.LoadedConfig;
|
import org.hibernate.boot.cfgxml.spi.LoadedConfig;
|
||||||
import org.hibernate.boot.registry.classloading.spi.ClassLoaderService;
|
import org.hibernate.boot.registry.classloading.spi.ClassLoaderService;
|
||||||
import org.hibernate.boot.spi.BootstrapContext;
|
|
||||||
import org.hibernate.boot.spi.MetadataImplementor;
|
import org.hibernate.boot.spi.MetadataImplementor;
|
||||||
import org.hibernate.boot.spi.SessionFactoryOptions;
|
import org.hibernate.boot.spi.SessionFactoryOptions;
|
||||||
import org.hibernate.cache.spi.CacheImplementor;
|
import org.hibernate.cache.spi.CacheImplementor;
|
||||||
|
@ -191,7 +190,6 @@ public final class SessionFactoryImpl implements SessionFactoryImplementor {
|
||||||
private final transient TypeHelper typeHelper;
|
private final transient TypeHelper typeHelper;
|
||||||
|
|
||||||
public SessionFactoryImpl(
|
public SessionFactoryImpl(
|
||||||
final BootstrapContext bootstrapContext,
|
|
||||||
final MetadataImplementor metadata,
|
final MetadataImplementor metadata,
|
||||||
SessionFactoryOptions options) {
|
SessionFactoryOptions options) {
|
||||||
LOG.debug( "Building session factory" );
|
LOG.debug( "Building session factory" );
|
||||||
|
@ -202,7 +200,7 @@ public final class SessionFactoryImpl implements SessionFactoryImplementor {
|
||||||
this.serviceRegistry = options
|
this.serviceRegistry = options
|
||||||
.getServiceRegistry()
|
.getServiceRegistry()
|
||||||
.getService( SessionFactoryServiceRegistryFactory.class )
|
.getService( SessionFactoryServiceRegistryFactory.class )
|
||||||
.buildServiceRegistry( this, bootstrapContext, options );
|
.buildServiceRegistry( this, options );
|
||||||
|
|
||||||
prepareEventListeners( metadata );
|
prepareEventListeners( metadata );
|
||||||
|
|
||||||
|
@ -291,7 +289,7 @@ public final class SessionFactoryImpl implements SessionFactoryImplementor {
|
||||||
|
|
||||||
LOG.debug( "Instantiated session factory" );
|
LOG.debug( "Instantiated session factory" );
|
||||||
|
|
||||||
this.metamodel = metadata.getTypeConfiguration().scope( this , bootstrapContext);
|
this.metamodel = metadata.getTypeConfiguration().scope( this );
|
||||||
( (MetamodelImpl) this.metamodel ).initialize(
|
( (MetamodelImpl) this.metamodel ).initialize(
|
||||||
metadata,
|
metadata,
|
||||||
determineJpaMetaModelPopulationSetting( properties )
|
determineJpaMetaModelPopulationSetting( properties )
|
||||||
|
|
|
@ -9,7 +9,6 @@ package org.hibernate.service.internal;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import org.hibernate.boot.spi.BootstrapContext;
|
|
||||||
import org.hibernate.boot.spi.SessionFactoryOptions;
|
import org.hibernate.boot.spi.SessionFactoryOptions;
|
||||||
import org.hibernate.engine.spi.SessionFactoryImplementor;
|
import org.hibernate.engine.spi.SessionFactoryImplementor;
|
||||||
import org.hibernate.service.Service;
|
import org.hibernate.service.Service;
|
||||||
|
@ -62,14 +61,12 @@ public class SessionFactoryServiceRegistryBuilderImpl implements SessionFactoryS
|
||||||
|
|
||||||
public SessionFactoryServiceRegistry buildSessionFactoryServiceRegistry(
|
public SessionFactoryServiceRegistry buildSessionFactoryServiceRegistry(
|
||||||
SessionFactoryImplementor sessionFactory,
|
SessionFactoryImplementor sessionFactory,
|
||||||
BootstrapContext bootstrapContext,
|
|
||||||
SessionFactoryOptions options) {
|
SessionFactoryOptions options) {
|
||||||
return new SessionFactoryServiceRegistryImpl(
|
return new SessionFactoryServiceRegistryImpl(
|
||||||
parent,
|
parent,
|
||||||
initiators,
|
initiators,
|
||||||
providedServices,
|
providedServices,
|
||||||
sessionFactory,
|
sessionFactory,
|
||||||
bootstrapContext,
|
|
||||||
options
|
options
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,7 +7,6 @@
|
||||||
package org.hibernate.service.internal;
|
package org.hibernate.service.internal;
|
||||||
|
|
||||||
import org.hibernate.boot.registry.classloading.spi.ClassLoaderService;
|
import org.hibernate.boot.registry.classloading.spi.ClassLoaderService;
|
||||||
import org.hibernate.boot.spi.BootstrapContext;
|
|
||||||
import org.hibernate.boot.spi.SessionFactoryOptions;
|
import org.hibernate.boot.spi.SessionFactoryOptions;
|
||||||
import org.hibernate.engine.spi.SessionFactoryImplementor;
|
import org.hibernate.engine.spi.SessionFactoryImplementor;
|
||||||
import org.hibernate.service.spi.ServiceRegistryImplementor;
|
import org.hibernate.service.spi.ServiceRegistryImplementor;
|
||||||
|
@ -31,7 +30,6 @@ public class SessionFactoryServiceRegistryFactoryImpl implements SessionFactoryS
|
||||||
@Override
|
@Override
|
||||||
public SessionFactoryServiceRegistry buildServiceRegistry(
|
public SessionFactoryServiceRegistry buildServiceRegistry(
|
||||||
SessionFactoryImplementor sessionFactory,
|
SessionFactoryImplementor sessionFactory,
|
||||||
BootstrapContext bootstrapContext,
|
|
||||||
SessionFactoryOptions options) {
|
SessionFactoryOptions options) {
|
||||||
final ClassLoaderService cls = options.getServiceRegistry().getService( ClassLoaderService.class );
|
final ClassLoaderService cls = options.getServiceRegistry().getService( ClassLoaderService.class );
|
||||||
final SessionFactoryServiceRegistryBuilderImpl builder = new SessionFactoryServiceRegistryBuilderImpl( theBasicServiceRegistry );
|
final SessionFactoryServiceRegistryBuilderImpl builder = new SessionFactoryServiceRegistryBuilderImpl( theBasicServiceRegistry );
|
||||||
|
@ -40,6 +38,6 @@ public class SessionFactoryServiceRegistryFactoryImpl implements SessionFactoryS
|
||||||
contributor.contribute( builder );
|
contributor.contribute( builder );
|
||||||
}
|
}
|
||||||
|
|
||||||
return builder.buildSessionFactoryServiceRegistry( sessionFactory, bootstrapContext, options );
|
return builder.buildSessionFactoryServiceRegistry( sessionFactory, options );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,7 +8,6 @@ package org.hibernate.service.internal;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import org.hibernate.boot.spi.BootstrapContext;
|
|
||||||
import org.hibernate.boot.spi.SessionFactoryOptions;
|
import org.hibernate.boot.spi.SessionFactoryOptions;
|
||||||
import org.hibernate.engine.config.spi.ConfigurationService;
|
import org.hibernate.engine.config.spi.ConfigurationService;
|
||||||
import org.hibernate.engine.spi.SessionFactoryImplementor;
|
import org.hibernate.engine.spi.SessionFactoryImplementor;
|
||||||
|
@ -33,21 +32,17 @@ public class SessionFactoryServiceRegistryImpl
|
||||||
private final SessionFactoryImplementor sessionFactory;
|
private final SessionFactoryImplementor sessionFactory;
|
||||||
private EventListenerRegistry cachedEventListenerRegistry;
|
private EventListenerRegistry cachedEventListenerRegistry;
|
||||||
|
|
||||||
private final BootstrapContext bootstrapContext;
|
|
||||||
|
|
||||||
@SuppressWarnings( {"unchecked"})
|
@SuppressWarnings( {"unchecked"})
|
||||||
public SessionFactoryServiceRegistryImpl(
|
public SessionFactoryServiceRegistryImpl(
|
||||||
ServiceRegistryImplementor parent,
|
ServiceRegistryImplementor parent,
|
||||||
List<SessionFactoryServiceInitiator> initiators,
|
List<SessionFactoryServiceInitiator> initiators,
|
||||||
List<ProvidedService> providedServices,
|
List<ProvidedService> providedServices,
|
||||||
SessionFactoryImplementor sessionFactory,
|
SessionFactoryImplementor sessionFactory,
|
||||||
BootstrapContext bootstrapContext,
|
|
||||||
SessionFactoryOptions sessionFactoryOptions) {
|
SessionFactoryOptions sessionFactoryOptions) {
|
||||||
super( parent );
|
super( parent );
|
||||||
|
|
||||||
this.sessionFactory = sessionFactory;
|
this.sessionFactory = sessionFactory;
|
||||||
this.sessionFactoryOptions = sessionFactoryOptions;
|
this.sessionFactoryOptions = sessionFactoryOptions;
|
||||||
this.bootstrapContext = bootstrapContext;
|
|
||||||
|
|
||||||
// for now, just use the standard initiator list
|
// for now, just use the standard initiator list
|
||||||
for ( SessionFactoryServiceInitiator initiator : initiators ) {
|
for ( SessionFactoryServiceInitiator initiator : initiators ) {
|
||||||
|
@ -58,8 +53,6 @@ public class SessionFactoryServiceRegistryImpl
|
||||||
for ( ProvidedService providedService : providedServices ) {
|
for ( ProvidedService providedService : providedServices ) {
|
||||||
createServiceBinding( providedService );
|
createServiceBinding( providedService );
|
||||||
}
|
}
|
||||||
|
|
||||||
bootstrapContext = null;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -75,11 +68,6 @@ public class SessionFactoryServiceRegistryImpl
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public BootstrapContext getBootstrapContext() {
|
|
||||||
return bootstrapContext;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public SessionFactoryImplementor getSessionFactory() {
|
public SessionFactoryImplementor getSessionFactory() {
|
||||||
return sessionFactory;
|
return sessionFactory;
|
||||||
|
|
|
@ -6,7 +6,6 @@
|
||||||
*/
|
*/
|
||||||
package org.hibernate.service.spi;
|
package org.hibernate.service.spi;
|
||||||
|
|
||||||
import org.hibernate.boot.spi.BootstrapContext;
|
|
||||||
import org.hibernate.boot.spi.SessionFactoryOptions;
|
import org.hibernate.boot.spi.SessionFactoryOptions;
|
||||||
import org.hibernate.engine.spi.SessionFactoryImplementor;
|
import org.hibernate.engine.spi.SessionFactoryImplementor;
|
||||||
|
|
||||||
|
@ -14,7 +13,6 @@ import org.hibernate.engine.spi.SessionFactoryImplementor;
|
||||||
* @author Steve Ebersole
|
* @author Steve Ebersole
|
||||||
*/
|
*/
|
||||||
public interface SessionFactoryServiceInitiatorContext {
|
public interface SessionFactoryServiceInitiatorContext {
|
||||||
BootstrapContext getBootstrapContext();
|
|
||||||
SessionFactoryImplementor getSessionFactory();
|
SessionFactoryImplementor getSessionFactory();
|
||||||
SessionFactoryOptions getSessionFactoryOptions();
|
SessionFactoryOptions getSessionFactoryOptions();
|
||||||
ServiceRegistryImplementor getServiceRegistry();
|
ServiceRegistryImplementor getServiceRegistry();
|
||||||
|
|
|
@ -6,7 +6,6 @@
|
||||||
*/
|
*/
|
||||||
package org.hibernate.service.spi;
|
package org.hibernate.service.spi;
|
||||||
|
|
||||||
import org.hibernate.boot.spi.BootstrapContext;
|
|
||||||
import org.hibernate.boot.spi.SessionFactoryOptions;
|
import org.hibernate.boot.spi.SessionFactoryOptions;
|
||||||
import org.hibernate.engine.spi.SessionFactoryImplementor;
|
import org.hibernate.engine.spi.SessionFactoryImplementor;
|
||||||
import org.hibernate.service.Service;
|
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
|
* 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.
|
* the session factory until after it has been fully initialized.
|
||||||
* @param sessionFactoryOptions The build options.
|
* @param sessionFactoryOptions The build options.
|
||||||
* @param bootstrapContext The (still active) BootstrapContext.
|
|
||||||
* @param sessionFactoryOptions The build options.
|
* @param sessionFactoryOptions The build options.
|
||||||
*
|
*
|
||||||
* @return The registry
|
* @return The registry
|
||||||
*/
|
*/
|
||||||
SessionFactoryServiceRegistry buildServiceRegistry(
|
SessionFactoryServiceRegistry buildServiceRegistry(
|
||||||
SessionFactoryImplementor sessionFactory,
|
SessionFactoryImplementor sessionFactory,
|
||||||
BootstrapContext bootstrapContext,
|
|
||||||
SessionFactoryOptions sessionFactoryOptions);
|
SessionFactoryOptions sessionFactoryOptions);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,7 +17,6 @@ import org.hibernate.Incubating;
|
||||||
import org.hibernate.SessionFactory;
|
import org.hibernate.SessionFactory;
|
||||||
import org.hibernate.SessionFactoryObserver;
|
import org.hibernate.SessionFactoryObserver;
|
||||||
import org.hibernate.boot.cfgxml.spi.CfgXmlAccessService;
|
import org.hibernate.boot.cfgxml.spi.CfgXmlAccessService;
|
||||||
import org.hibernate.boot.spi.BootstrapContext;
|
|
||||||
import org.hibernate.boot.spi.MetadataBuildingContext;
|
import org.hibernate.boot.spi.MetadataBuildingContext;
|
||||||
import org.hibernate.engine.spi.SessionFactoryImplementor;
|
import org.hibernate.engine.spi.SessionFactoryImplementor;
|
||||||
import org.hibernate.id.uuid.LocalObjectUuidHelper;
|
import org.hibernate.id.uuid.LocalObjectUuidHelper;
|
||||||
|
@ -143,7 +142,7 @@ public class TypeConfiguration implements SessionFactoryObserver, Serializable {
|
||||||
scope.setMetadataBuildingContext( metadataBuildingContext );
|
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 );
|
log.debugf( "Scoping TypeConfiguration [%s] to SessionFactoryImpl [%s]", this, sessionFactory );
|
||||||
|
|
||||||
for ( Map.Entry<String, String> importEntry : scope.metadataBuildingContext.getMetadataCollector().getImports().entrySet() ) {
|
for ( Map.Entry<String, String> importEntry : scope.metadataBuildingContext.getMetadataCollector().getImports().entrySet() ) {
|
||||||
|
|
Loading…
Reference in New Issue