HHH-18437 - Remove deprecations from JdbcSessionContext

Signed-off-by: Jan Schatteman <jschatte@redhat.com>
This commit is contained in:
Jan Schatteman 2024-07-31 17:55:31 +02:00 committed by Steve Ebersole
parent dfb268ae2a
commit e3fd3fad17
4 changed files with 0 additions and 45 deletions

View File

@ -32,7 +32,6 @@ import org.hibernate.engine.jdbc.internal.JdbcCoordinatorImpl;
import org.hibernate.engine.jdbc.internal.JdbcServicesImpl; import org.hibernate.engine.jdbc.internal.JdbcServicesImpl;
import org.hibernate.engine.jdbc.spi.JdbcServices; import org.hibernate.engine.jdbc.spi.JdbcServices;
import org.hibernate.engine.jdbc.spi.SqlExceptionHelper; import org.hibernate.engine.jdbc.spi.SqlExceptionHelper;
import org.hibernate.engine.spi.SessionFactoryImplementor;
import org.hibernate.event.internal.EmptyEventManager; import org.hibernate.event.internal.EmptyEventManager;
import org.hibernate.event.spi.EventManager; import org.hibernate.event.spi.EventManager;
import org.hibernate.internal.CoreMessageLogger; import org.hibernate.internal.CoreMessageLogger;
@ -47,7 +46,6 @@ import org.hibernate.resource.jdbc.spi.PhysicalConnectionHandlingMode;
import org.hibernate.resource.jdbc.spi.StatementInspector; import org.hibernate.resource.jdbc.spi.StatementInspector;
import org.hibernate.resource.transaction.spi.TransactionCoordinator; import org.hibernate.resource.transaction.spi.TransactionCoordinator;
import org.hibernate.resource.transaction.spi.TransactionCoordinatorBuilder; import org.hibernate.resource.transaction.spi.TransactionCoordinatorBuilder;
import org.hibernate.service.ServiceRegistry;
import org.hibernate.service.spi.ServiceRegistryImplementor; import org.hibernate.service.spi.ServiceRegistryImplementor;
import org.hibernate.stat.spi.StatisticsImplementor; import org.hibernate.stat.spi.StatisticsImplementor;
@ -613,7 +611,6 @@ public class JdbcEnvironmentInitiator implements StandardServiceInitiator<JdbcEn
private final JdbcConnectionAccess jdbcConnectionAccess; private final JdbcConnectionAccess jdbcConnectionAccess;
private final JdbcServices jdbcServices; private final JdbcServices jdbcServices;
private final ServiceRegistryImplementor serviceRegistry;
private final boolean jtaTrackByThread; private final boolean jtaTrackByThread;
private final boolean preferUserTransaction; private final boolean preferUserTransaction;
private final boolean connectionProviderDisablesAutoCommit; private final boolean connectionProviderDisablesAutoCommit;
@ -631,7 +628,6 @@ public class JdbcEnvironmentInitiator implements StandardServiceInitiator<JdbcEn
this.jdbcConnectionAccess = jdbcConnectionAccess; this.jdbcConnectionAccess = jdbcConnectionAccess;
this.jdbcServices = jdbcServices; this.jdbcServices = jdbcServices;
this.sqlExceptionHelper = sqlExceptionHelper; this.sqlExceptionHelper = sqlExceptionHelper;
this.serviceRegistry = serviceRegistry;
final ConfigurationService configuration = serviceRegistry.requireService( ConfigurationService.class ); final ConfigurationService configuration = serviceRegistry.requireService( ConfigurationService.class );
this.jtaTrackByThread = configuration.getSetting( JTA_TRACK_BY_THREAD, BOOLEAN, true ); this.jtaTrackByThread = configuration.getSetting( JTA_TRACK_BY_THREAD, BOOLEAN, true );
this.preferUserTransaction = getBoolean( PREFER_USER_TRANSACTION, configuration.getSettings() ); this.preferUserTransaction = getBoolean( PREFER_USER_TRANSACTION, configuration.getSettings() );
@ -754,16 +750,6 @@ public class JdbcEnvironmentInitiator implements StandardServiceInitiator<JdbcEn
return EMPTY_JDBC_EVENT_HANDLER; return EMPTY_JDBC_EVENT_HANDLER;
} }
@Override
public SessionFactoryImplementor getSessionFactory() {
return null;
}
@Override
public ServiceRegistry getServiceRegistry() {
return serviceRegistry;
}
@Override @Override
public JdbcServices getJdbcServices() { public JdbcServices getJdbcServices() {
return jdbcServices; return jdbcServices;

View File

@ -15,7 +15,6 @@ import org.hibernate.resource.jdbc.spi.JdbcEventHandler;
import org.hibernate.resource.jdbc.spi.JdbcSessionContext; import org.hibernate.resource.jdbc.spi.JdbcSessionContext;
import org.hibernate.resource.jdbc.spi.PhysicalConnectionHandlingMode; import org.hibernate.resource.jdbc.spi.PhysicalConnectionHandlingMode;
import org.hibernate.resource.jdbc.spi.StatementInspector; import org.hibernate.resource.jdbc.spi.StatementInspector;
import org.hibernate.service.ServiceRegistry;
import org.hibernate.stat.spi.StatisticsImplementor; import org.hibernate.stat.spi.StatisticsImplementor;
/** /**
@ -99,16 +98,6 @@ public class JdbcSessionContextImpl implements JdbcSessionContext {
return jdbcEventHandler; return jdbcEventHandler;
} }
@Override @Deprecated
public SessionFactoryImplementor getSessionFactory() {
return sessionFactory;
}
@Override @Deprecated
public ServiceRegistry getServiceRegistry() {
return sessionFactory.getServiceRegistry();
}
private SessionFactoryOptions settings() { private SessionFactoryOptions settings() {
return sessionFactory.getSessionFactoryOptions(); return sessionFactory.getSessionFactoryOptions();
} }

View File

@ -8,9 +8,7 @@ package org.hibernate.resource.jdbc.spi;
import org.hibernate.engine.jdbc.batch.spi.BatchBuilder; import org.hibernate.engine.jdbc.batch.spi.BatchBuilder;
import org.hibernate.engine.jdbc.spi.JdbcServices; import org.hibernate.engine.jdbc.spi.JdbcServices;
import org.hibernate.engine.spi.SessionFactoryImplementor;
import org.hibernate.jpa.spi.JpaCompliance; import org.hibernate.jpa.spi.JpaCompliance;
import org.hibernate.service.ServiceRegistry;
import org.hibernate.stat.spi.StatisticsImplementor; import org.hibernate.stat.spi.StatisticsImplementor;
/** /**
@ -59,23 +57,6 @@ public interface JdbcSessionContext {
JdbcEventHandler getEventHandler(); JdbcEventHandler getEventHandler();
/**
* Retrieve the session factory for this environment.
*
* @deprecated exposing this here seems to kinda defeat the purpose of this SPI
*/
@Deprecated(since = "6.2")
SessionFactoryImplementor getSessionFactory();
/**
* Retrieve the service registry.
*
* @deprecated this is no longer called, and unnecessary, since the needed
* services are now available via {@link #getJdbcServices()}
*/
@Deprecated(since = "6.2")
ServiceRegistry getServiceRegistry();
JdbcServices getJdbcServices(); JdbcServices getJdbcServices();
BatchBuilder getBatchBuilder(); BatchBuilder getBatchBuilder();

View File

@ -61,7 +61,6 @@ public class JdbcCoordinatorTest {
jdbcConnectionAccess ); jdbcConnectionAccess );
ServiceRegistry serviceRegistry = Mockito.mock( ServiceRegistry.class ); ServiceRegistry serviceRegistry = Mockito.mock( ServiceRegistry.class );
when( sessionContext.getServiceRegistry() ).thenReturn( serviceRegistry );
when( sessionContext.getPhysicalConnectionHandlingMode() ).thenReturn( when( sessionContext.getPhysicalConnectionHandlingMode() ).thenReturn(
PhysicalConnectionHandlingMode.IMMEDIATE_ACQUISITION_AND_HOLD ); PhysicalConnectionHandlingMode.IMMEDIATE_ACQUISITION_AND_HOLD );