From 07fe08774fc6e5cc198e1dcd952a151f73e0208a Mon Sep 17 00:00:00 2001 From: Sanne Grinovero Date: Fri, 15 Sep 2023 19:35:28 +0200 Subject: [PATCH] HHH-17220 Avoid runtime lookups of JdbcService from TableGenerator and TableStructure --- .../main/java/org/hibernate/id/enhanced/TableGenerator.java | 5 ++--- .../main/java/org/hibernate/id/enhanced/TableStructure.java | 4 +--- 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/hibernate-core/src/main/java/org/hibernate/id/enhanced/TableGenerator.java b/hibernate-core/src/main/java/org/hibernate/id/enhanced/TableGenerator.java index 337f1217db..8f9f9ee20b 100644 --- a/hibernate-core/src/main/java/org/hibernate/id/enhanced/TableGenerator.java +++ b/hibernate-core/src/main/java/org/hibernate/id/enhanced/TableGenerator.java @@ -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(); diff --git a/hibernate-core/src/main/java/org/hibernate/id/enhanced/TableStructure.java b/hibernate-core/src/main/java/org/hibernate/id/enhanced/TableStructure.java index 63900ff66e..0d1527476c 100644 --- a/hibernate-core/src/main/java/org/hibernate/id/enhanced/TableStructure.java +++ b/hibernate-core/src/main/java/org/hibernate/id/enhanced/TableStructure.java @@ -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" );