HHH-17115 Resolve type pollution problems on lookup of JdbcValuesMappingProducerProvider
This commit is contained in:
parent
db0427173b
commit
a6d1bea5b9
|
@ -24,8 +24,6 @@ import org.hibernate.procedure.internal.Util;
|
||||||
import org.hibernate.procedure.spi.NamedCallableQueryMemento;
|
import org.hibernate.procedure.spi.NamedCallableQueryMemento;
|
||||||
import org.hibernate.procedure.spi.ParameterStrategy;
|
import org.hibernate.procedure.spi.ParameterStrategy;
|
||||||
import org.hibernate.query.results.ResultSetMapping;
|
import org.hibernate.query.results.ResultSetMapping;
|
||||||
import org.hibernate.query.results.ResultSetMappingImpl;
|
|
||||||
import org.hibernate.sql.results.jdbc.spi.JdbcValuesMappingProducerProvider;
|
|
||||||
|
|
||||||
import jakarta.persistence.NamedStoredProcedureQuery;
|
import jakarta.persistence.NamedStoredProcedureQuery;
|
||||||
import jakarta.persistence.ParameterMode;
|
import jakarta.persistence.ParameterMode;
|
||||||
|
@ -129,8 +127,8 @@ public class NamedProcedureCallDefinitionImpl implements NamedProcedureCallDefin
|
||||||
|
|
||||||
private ResultSetMapping buildResultSetMapping(String registeredName, SessionFactoryImplementor sessionFactory) {
|
private ResultSetMapping buildResultSetMapping(String registeredName, SessionFactoryImplementor sessionFactory) {
|
||||||
return sessionFactory
|
return sessionFactory
|
||||||
.getServiceRegistry()
|
.getFastSessionServices()
|
||||||
.getService( JdbcValuesMappingProducerProvider.class )
|
.getJdbcValuesMappingProducerProvider()
|
||||||
.buildResultSetMapping( registeredName, false, sessionFactory );
|
.buildResultSetMapping( registeredName, false, sessionFactory );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -68,6 +68,7 @@ import org.hibernate.jpa.internal.util.LockOptionsHelper;
|
||||||
import org.hibernate.resource.transaction.spi.TransactionCoordinatorBuilder;
|
import org.hibernate.resource.transaction.spi.TransactionCoordinatorBuilder;
|
||||||
import org.hibernate.service.spi.ServiceRegistryImplementor;
|
import org.hibernate.service.spi.ServiceRegistryImplementor;
|
||||||
import org.hibernate.sql.ast.spi.ParameterMarkerStrategy;
|
import org.hibernate.sql.ast.spi.ParameterMarkerStrategy;
|
||||||
|
import org.hibernate.sql.results.jdbc.spi.JdbcValuesMappingProducerProvider;
|
||||||
import org.hibernate.type.format.FormatMapper;
|
import org.hibernate.type.format.FormatMapper;
|
||||||
|
|
||||||
import jakarta.persistence.CacheRetrieveMode;
|
import jakarta.persistence.CacheRetrieveMode;
|
||||||
|
@ -182,6 +183,7 @@ public final class FastSessionServices {
|
||||||
private final FormatMapper jsonFormatMapper;
|
private final FormatMapper jsonFormatMapper;
|
||||||
private final FormatMapper xmlFormatMapper;
|
private final FormatMapper xmlFormatMapper;
|
||||||
private final MutationExecutorService mutationExecutorService;
|
private final MutationExecutorService mutationExecutorService;
|
||||||
|
private final JdbcValuesMappingProducerProvider jdbcValuesMappingProducerProvider;
|
||||||
|
|
||||||
FastSessionServices(SessionFactoryImplementor sessionFactory) {
|
FastSessionServices(SessionFactoryImplementor sessionFactory) {
|
||||||
Objects.requireNonNull( sessionFactory );
|
Objects.requireNonNull( sessionFactory );
|
||||||
|
@ -250,6 +252,8 @@ public final class FastSessionServices {
|
||||||
this.transactionCoordinatorBuilder = serviceRegistry.getService( TransactionCoordinatorBuilder.class );
|
this.transactionCoordinatorBuilder = serviceRegistry.getService( TransactionCoordinatorBuilder.class );
|
||||||
this.jdbcServices = serviceRegistry.getService( JdbcServices.class );
|
this.jdbcServices = serviceRegistry.getService( JdbcServices.class );
|
||||||
this.entityCopyObserverFactory = serviceRegistry.getService( EntityCopyObserverFactory.class );
|
this.entityCopyObserverFactory = serviceRegistry.getService( EntityCopyObserverFactory.class );
|
||||||
|
this.jdbcValuesMappingProducerProvider = serviceRegistry.getService( JdbcValuesMappingProducerProvider.class );
|
||||||
|
|
||||||
|
|
||||||
this.isJtaTransactionAccessible = isTransactionAccessible( sessionFactory, transactionCoordinatorBuilder );
|
this.isJtaTransactionAccessible = isTransactionAccessible( sessionFactory, transactionCoordinatorBuilder );
|
||||||
|
|
||||||
|
@ -369,6 +373,10 @@ public final class FastSessionServices {
|
||||||
return defaultJdbcObservers;
|
return defaultJdbcObservers;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public JdbcValuesMappingProducerProvider getJdbcValuesMappingProducerProvider() {
|
||||||
|
return this.jdbcValuesMappingProducerProvider;
|
||||||
|
}
|
||||||
|
|
||||||
public boolean useStreamForLobBinding() {
|
public boolean useStreamForLobBinding() {
|
||||||
return useStreamForLobBinding;
|
return useStreamForLobBinding;
|
||||||
}
|
}
|
||||||
|
|
|
@ -267,6 +267,7 @@ public class SessionFactoryImpl extends QueryParameterBindingTypeResolverImpl im
|
||||||
runtimeMetamodels = runtimeMetamodelsImpl;
|
runtimeMetamodels = runtimeMetamodelsImpl;
|
||||||
final MappingMetamodelImpl mappingMetamodelImpl = new MappingMetamodelImpl( typeConfiguration, serviceRegistry );
|
final MappingMetamodelImpl mappingMetamodelImpl = new MappingMetamodelImpl( typeConfiguration, serviceRegistry );
|
||||||
runtimeMetamodelsImpl.setMappingMetamodel( mappingMetamodelImpl );
|
runtimeMetamodelsImpl.setMappingMetamodel( mappingMetamodelImpl );
|
||||||
|
fastSessionServices = new FastSessionServices( this );
|
||||||
initializeMappingModel( mappingMetamodelImpl, bootstrapContext, bootMetamodel, options );
|
initializeMappingModel( mappingMetamodelImpl, bootstrapContext, bootMetamodel, options );
|
||||||
runtimeMetamodelsImpl.setJpaMetamodel( mappingMetamodelImpl.getJpaMetamodel() );
|
runtimeMetamodelsImpl.setJpaMetamodel( mappingMetamodelImpl.getJpaMetamodel() );
|
||||||
|
|
||||||
|
@ -277,7 +278,7 @@ public class SessionFactoryImpl extends QueryParameterBindingTypeResolverImpl im
|
||||||
defaultSessionOpenOptions = createDefaultSessionOpenOptionsIfPossible();
|
defaultSessionOpenOptions = createDefaultSessionOpenOptionsIfPossible();
|
||||||
temporarySessionOpenOptions = defaultSessionOpenOptions == null ? null : buildTemporarySessionOpenOptions();
|
temporarySessionOpenOptions = defaultSessionOpenOptions == null ? null : buildTemporarySessionOpenOptions();
|
||||||
defaultStatelessOptions = defaultSessionOpenOptions == null ? null : withStatelessOptions();
|
defaultStatelessOptions = defaultSessionOpenOptions == null ? null : withStatelessOptions();
|
||||||
fastSessionServices = new FastSessionServices( this );
|
|
||||||
wrapperOptions = new SessionFactoryBasedWrapperOptions( this );
|
wrapperOptions = new SessionFactoryBasedWrapperOptions( this );
|
||||||
|
|
||||||
currentSessionContext = buildCurrentSessionContext();
|
currentSessionContext = buildCurrentSessionContext();
|
||||||
|
|
|
@ -16,7 +16,6 @@ import org.hibernate.query.NativeQuery;
|
||||||
import org.hibernate.query.named.NamedResultSetMappingMemento;
|
import org.hibernate.query.named.NamedResultSetMappingMemento;
|
||||||
import org.hibernate.query.results.dynamic.DynamicFetchBuilderLegacy;
|
import org.hibernate.query.results.dynamic.DynamicFetchBuilderLegacy;
|
||||||
import org.hibernate.sql.results.jdbc.spi.JdbcValuesMappingProducer;
|
import org.hibernate.sql.results.jdbc.spi.JdbcValuesMappingProducer;
|
||||||
import org.hibernate.sql.results.jdbc.spi.JdbcValuesMappingProducerProvider;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Acts as the {@link JdbcValuesMappingProducer} for {@link NativeQuery}
|
* Acts as the {@link JdbcValuesMappingProducer} for {@link NativeQuery}
|
||||||
|
@ -96,8 +95,8 @@ public interface ResultSetMapping extends JdbcValuesMappingProducer {
|
||||||
|
|
||||||
static ResultSetMapping resolveResultSetMapping(String name, boolean isDynamic, SessionFactoryImplementor sessionFactory) {
|
static ResultSetMapping resolveResultSetMapping(String name, boolean isDynamic, SessionFactoryImplementor sessionFactory) {
|
||||||
return sessionFactory
|
return sessionFactory
|
||||||
.getServiceRegistry()
|
.getFastSessionServices()
|
||||||
.getService( JdbcValuesMappingProducerProvider.class )
|
.getJdbcValuesMappingProducerProvider()
|
||||||
.buildResultSetMapping( name, isDynamic, sessionFactory );
|
.buildResultSetMapping( name, isDynamic, sessionFactory );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -867,8 +867,8 @@ public abstract class AbstractSqlAstTranslator<T extends JdbcOperation> implemen
|
||||||
|
|
||||||
private JdbcValuesMappingProducer buildJdbcValuesMappingProducer(SelectStatement selectStatement) {
|
private JdbcValuesMappingProducer buildJdbcValuesMappingProducer(SelectStatement selectStatement) {
|
||||||
final JdbcValuesMappingProducerProvider producerProvider = getSessionFactory()
|
final JdbcValuesMappingProducerProvider producerProvider = getSessionFactory()
|
||||||
.getServiceRegistry()
|
.getFastSessionServices()
|
||||||
.getService( JdbcValuesMappingProducerProvider.class );
|
.getJdbcValuesMappingProducerProvider();
|
||||||
return producerProvider.buildMappingProducer( selectStatement, getSessionFactory() );
|
return producerProvider.buildMappingProducer( selectStatement, getSessionFactory() );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue