HHH-17220 Avoid runtime lookups of JdbcService from TableGenerator and TableStructure

This commit is contained in:
Sanne Grinovero 2023-09-15 19:35:28 +02:00 committed by Sanne Grinovero
parent 0ecd5d8a45
commit 07fe08774f
2 changed files with 3 additions and 6 deletions

View File

@ -31,7 +31,6 @@ import org.hibernate.engine.config.spi.StandardConverters;
import org.hibernate.engine.jdbc.Size;
import org.hibernate.engine.jdbc.env.spi.JdbcEnvironment;
import org.hibernate.engine.jdbc.internal.FormatStyle;
import org.hibernate.engine.jdbc.spi.JdbcServices;
import org.hibernate.engine.jdbc.spi.SqlStatementLogger;
import org.hibernate.engine.spi.SessionEventListenerManager;
import org.hibernate.engine.spi.SharedSessionContractImplementor;
@ -555,8 +554,8 @@ public class TableGenerator implements PersistentIdentifierGenerator {
@Override
public Object generate(final SharedSessionContractImplementor session, final Object obj) {
final SqlStatementLogger statementLogger = session.getFactory().getServiceRegistry()
.getService( JdbcServices.class )
final SqlStatementLogger statementLogger = session.
getFactory().getJdbcServices()
.getSqlStatementLogger();
final SessionEventListenerManager statsCollector = session.getEventListenerManager();

View File

@ -23,7 +23,6 @@ import org.hibernate.boot.model.relational.SqlStringGenerationContext;
import org.hibernate.dialect.Dialect;
import org.hibernate.engine.jdbc.env.spi.JdbcEnvironment;
import org.hibernate.engine.jdbc.internal.FormatStyle;
import org.hibernate.engine.jdbc.spi.JdbcServices;
import org.hibernate.engine.jdbc.spi.SqlStatementLogger;
import org.hibernate.engine.spi.SessionEventListenerManager;
import org.hibernate.engine.spi.SharedSessionContractImplementor;
@ -120,8 +119,7 @@ public class TableStructure implements DatabaseStructure {
@Override
public AccessCallback buildCallback(final SharedSessionContractImplementor session) {
final SqlStatementLogger statementLogger = session.getFactory().getServiceRegistry()
.getService( JdbcServices.class )
final SqlStatementLogger statementLogger = session.getFactory().getJdbcServices()
.getSqlStatementLogger();
if ( selectQuery == null || updateQuery == null ) {
throw new AssertionFailure( "SequenceStyleGenerator's TableStructure was not properly initialized" );