From 73e85ee761a455a12aab7132bfa308fa50c6680a Mon Sep 17 00:00:00 2001 From: Steve Ebersole Date: Sat, 5 Mar 2011 08:06:21 -0600 Subject: [PATCH] HHH-5781 - Refactor code in org.hibernate.jdbc to spi/internal and remove obsolete code --- .../main/java/org/hibernate/cfg/Settings.java | 28 ---- .../org/hibernate/cfg/SettingsFactory.java | 10 -- .../engine/SessionFactoryImplementor.java | 10 +- .../batch/internal/AbstractBatchImpl.java | 8 +- .../jdbc/internal}/BasicFormatterImpl.java | 26 ++-- .../jdbc/internal}/DDLFormatterImpl.java | 7 +- .../jdbc/internal}/FormatStyle.java | 33 +---- .../jdbc/internal}/Formatter.java | 14 +- .../jdbc/internal/JdbcCoordinatorImpl.java | 4 +- .../internal/JdbcResourceRegistryImpl.java | 6 +- .../jdbc/internal/JdbcServicesImpl.java | 18 ++- .../jdbc/internal/StatementPreparerImpl.java | 4 +- .../jdbc/internal}/TypeInfo.java | 2 +- .../jdbc/internal}/TypeInfoExtracter.java | 2 +- .../jdbc/internal}/TypeNullability.java | 2 +- .../jdbc/internal}/TypeSearchability.java | 2 +- .../jdbc/spi/ExtractedDatabaseMetaData.java | 2 +- .../engine/jdbc/spi/JdbcServices.java | 4 +- ...ionHelper.java => SqlExceptionHelper.java} | 8 +- ...entLogger.java => SqlStatementLogger.java} | 16 +-- .../internal/jdbc/JdbcIsolationDelegate.java | 4 +- .../internal/jta/JtaIsolationDelegate.java | 4 +- .../id/MultipleHiLoPerTableGenerator.java | 6 +- .../java/org/hibernate/id/TableGenerator.java | 6 +- .../hibernate/id/enhanced/TableGenerator.java | 6 +- .../hibernate/id/enhanced/TableStructure.java | 6 +- .../hibernate/impl/SessionFactoryImpl.java | 5 +- .../main/java/org/hibernate/jdbc/package.html | 7 +- .../jdbc/util/SQLStatementLogger.java | 120 ------------------ .../metamodel/relational/Datatype.java | 2 +- .../AbstractCollectionPersister.java | 6 +- .../hibernate/tool/hbm2ddl/SchemaExport.java | 8 +- .../hibernate/tool/hbm2ddl/SchemaUpdate.java | 9 +- .../jdbc/util/BasicFormatterTest.java | 2 + .../common/BasicTestingJdbcServiceImpl.java | 18 +-- .../org/hibernate/test/jdbc/TypeInfoTest.java | 4 +- 36 files changed, 120 insertions(+), 299 deletions(-) rename hibernate-core/src/main/java/org/hibernate/{jdbc/util => engine/jdbc/internal}/BasicFormatterImpl.java (89%) rename hibernate-core/src/main/java/org/hibernate/{jdbc/util => engine/jdbc/internal}/DDLFormatterImpl.java (96%) rename hibernate-core/src/main/java/org/hibernate/{jdbc/util => engine/jdbc/internal}/FormatStyle.java (65%) rename hibernate-core/src/main/java/org/hibernate/{jdbc/util => engine/jdbc/internal}/Formatter.java (78%) rename hibernate-core/src/main/java/org/hibernate/{internal/util/jdbc => engine/jdbc/internal}/TypeInfo.java (98%) rename hibernate-core/src/main/java/org/hibernate/{internal/util/jdbc => engine/jdbc/internal}/TypeInfoExtracter.java (98%) rename hibernate-core/src/main/java/org/hibernate/{internal/util/jdbc => engine/jdbc/internal}/TypeNullability.java (98%) rename hibernate-core/src/main/java/org/hibernate/{internal/util/jdbc => engine/jdbc/internal}/TypeSearchability.java (98%) rename hibernate-core/src/main/java/org/hibernate/engine/jdbc/spi/{SQLExceptionHelper.java => SqlExceptionHelper.java} (96%) rename hibernate-core/src/main/java/org/hibernate/engine/jdbc/spi/{SQLStatementLogger.java => SqlStatementLogger.java} (86%) delete mode 100644 hibernate-core/src/main/java/org/hibernate/jdbc/util/SQLStatementLogger.java diff --git a/hibernate-core/src/main/java/org/hibernate/cfg/Settings.java b/hibernate-core/src/main/java/org/hibernate/cfg/Settings.java index fbc5e31eac..01ec78b7dc 100644 --- a/hibernate-core/src/main/java/org/hibernate/cfg/Settings.java +++ b/hibernate-core/src/main/java/org/hibernate/cfg/Settings.java @@ -29,7 +29,6 @@ import org.hibernate.cache.QueryCacheFactory; import org.hibernate.cache.RegionFactory; import org.hibernate.engine.jdbc.JdbcSupport; import org.hibernate.hql.QueryTranslatorFactory; -import org.hibernate.jdbc.util.SQLStatementLogger; import org.hibernate.service.jta.platform.spi.JtaPlatform; import org.hibernate.tuple.entity.EntityTuplizerFactory; @@ -42,9 +41,6 @@ import java.util.Map; */ public final class Settings { -// private boolean showSql; -// private boolean formatSql; - private SQLStatementLogger sqlStatementLogger; private Integer maximumFetchDepth; private Map querySubstitutions; private int jdbcBatchSize; @@ -99,14 +95,6 @@ public final class Settings { // public getters ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -// public boolean isShowSqlEnabled() { -// return showSql; -// } -// -// public boolean isFormatSqlEnabled() { -// return formatSql; -// } - public String getImportFiles() { return importFiles; } @@ -115,10 +103,6 @@ public final class Settings { this.importFiles = importFiles; } - public SQLStatementLogger getSqlStatementLogger() { - return sqlStatementLogger; - } - public String getDefaultSchemaName() { return defaultSchemaName; } @@ -282,18 +266,6 @@ public final class Settings { // package protected setters ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -// void setShowSqlEnabled(boolean b) { -// showSql = b; -// } -// -// void setFormatSqlEnabled(boolean b) { -// formatSql = b; -// } - - void setSqlStatementLogger(SQLStatementLogger sqlStatementLogger) { - this.sqlStatementLogger = sqlStatementLogger; - } - void setDefaultSchemaName(String string) { defaultSchemaName = string; } diff --git a/hibernate-core/src/main/java/org/hibernate/cfg/SettingsFactory.java b/hibernate-core/src/main/java/org/hibernate/cfg/SettingsFactory.java index 73801f2b98..b6944c84d0 100644 --- a/hibernate-core/src/main/java/org/hibernate/cfg/SettingsFactory.java +++ b/hibernate-core/src/main/java/org/hibernate/cfg/SettingsFactory.java @@ -44,7 +44,6 @@ import org.hibernate.engine.jdbc.spi.JdbcServices; import org.hibernate.engine.transaction.spi.TransactionFactory; import org.hibernate.hql.QueryTranslatorFactory; import org.hibernate.internal.util.config.ConfigurationHelper; -import org.hibernate.jdbc.util.SQLStatementLogger; import org.hibernate.service.jta.platform.spi.JtaPlatform; import org.hibernate.service.spi.ServiceRegistry; import org.hibernate.util.ReflectHelper; @@ -214,15 +213,6 @@ public class SettingsFactory implements Serializable { //Statistics and logging: - boolean showSql = ConfigurationHelper.getBoolean(Environment.SHOW_SQL, properties); - if (showSql) log.info("Echoing all SQL to stdout"); -// settings.setShowSqlEnabled(showSql); - - boolean formatSql = ConfigurationHelper.getBoolean(Environment.FORMAT_SQL, properties); -// settings.setFormatSqlEnabled(formatSql); - - settings.setSqlStatementLogger( new SQLStatementLogger( showSql, formatSql ) ); - boolean useStatistics = ConfigurationHelper.getBoolean(Environment.GENERATE_STATISTICS, properties); log.info( "Statistics: " + enabledDisabled(useStatistics) ); settings.setStatisticsEnabled(useStatistics); diff --git a/hibernate-core/src/main/java/org/hibernate/engine/SessionFactoryImplementor.java b/hibernate-core/src/main/java/org/hibernate/engine/SessionFactoryImplementor.java index a72b2aee50..8c876a7041 100644 --- a/hibernate-core/src/main/java/org/hibernate/engine/SessionFactoryImplementor.java +++ b/hibernate-core/src/main/java/org/hibernate/engine/SessionFactoryImplementor.java @@ -29,15 +29,13 @@ import java.util.Properties; import java.util.Set; import java.sql.Connection; -import javax.transaction.TransactionManager; - import org.hibernate.HibernateException; import org.hibernate.Interceptor; import org.hibernate.MappingException; import org.hibernate.SessionFactory; import org.hibernate.ConnectionReleaseMode; import org.hibernate.engine.jdbc.spi.JdbcServices; -import org.hibernate.engine.jdbc.spi.SQLExceptionHelper; +import org.hibernate.engine.jdbc.spi.SqlExceptionHelper; import org.hibernate.proxy.EntityNotFoundDelegate; import org.hibernate.engine.query.QueryPlanCache; import org.hibernate.engine.profile.FetchProfile; @@ -202,12 +200,12 @@ public interface SessionFactoryImplementor extends Mapping, SessionFactory { // TODO: deprecate??? /** - * Retrieves the SQLExceptionHelper in effect for this SessionFactory. + * Retrieves the SqlExceptionHelper in effect for this SessionFactory. * - * @return The SQLExceptionHelper for this SessionFactory. + * @return The SqlExceptionHelper for this SessionFactory. * */ - public SQLExceptionHelper getSQLExceptionHelper(); + public SqlExceptionHelper getSQLExceptionHelper(); public Settings getSettings(); diff --git a/hibernate-core/src/main/java/org/hibernate/engine/jdbc/batch/internal/AbstractBatchImpl.java b/hibernate-core/src/main/java/org/hibernate/engine/jdbc/batch/internal/AbstractBatchImpl.java index a0c4bd2b97..41560f003b 100644 --- a/hibernate-core/src/main/java/org/hibernate/engine/jdbc/batch/internal/AbstractBatchImpl.java +++ b/hibernate-core/src/main/java/org/hibernate/engine/jdbc/batch/internal/AbstractBatchImpl.java @@ -27,8 +27,8 @@ import org.hibernate.engine.jdbc.batch.spi.Batch; import org.hibernate.engine.jdbc.batch.spi.BatchKey; import org.hibernate.engine.jdbc.batch.spi.BatchObserver; import org.hibernate.engine.jdbc.spi.JdbcCoordinator; -import org.hibernate.engine.jdbc.spi.SQLExceptionHelper; -import org.hibernate.engine.jdbc.spi.SQLStatementLogger; +import org.hibernate.engine.jdbc.spi.SqlExceptionHelper; +import org.hibernate.engine.jdbc.spi.SqlStatementLogger; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -74,7 +74,7 @@ public abstract class AbstractBatchImpl implements Batch { * * @return The underlying SQLException helper. */ - protected SQLExceptionHelper sqlExceptionHelper() { + protected SqlExceptionHelper sqlExceptionHelper() { return jdbcCoordinator.getTransactionCoordinator() .getTransactionContext() .getTransactionEnvironment() @@ -87,7 +87,7 @@ public abstract class AbstractBatchImpl implements Batch { * * @return The underlying JDBC services. */ - protected SQLStatementLogger sqlStatementLogger() { + protected SqlStatementLogger sqlStatementLogger() { return jdbcCoordinator.getTransactionCoordinator() .getTransactionContext() .getTransactionEnvironment() diff --git a/hibernate-core/src/main/java/org/hibernate/jdbc/util/BasicFormatterImpl.java b/hibernate-core/src/main/java/org/hibernate/engine/jdbc/internal/BasicFormatterImpl.java similarity index 89% rename from hibernate-core/src/main/java/org/hibernate/jdbc/util/BasicFormatterImpl.java rename to hibernate-core/src/main/java/org/hibernate/engine/jdbc/internal/BasicFormatterImpl.java index 68f6a8d89f..8f85174cfd 100755 --- a/hibernate-core/src/main/java/org/hibernate/jdbc/util/BasicFormatterImpl.java +++ b/hibernate-core/src/main/java/org/hibernate/engine/jdbc/internal/BasicFormatterImpl.java @@ -22,7 +22,7 @@ * Boston, MA 02110-1301 USA * */ -package org.hibernate.jdbc.util; +package org.hibernate.engine.jdbc.internal; import java.util.HashSet; import java.util.LinkedList; @@ -39,12 +39,12 @@ import org.hibernate.util.StringHelper; */ public class BasicFormatterImpl implements Formatter { - private static final Set BEGIN_CLAUSES = new HashSet(); - private static final Set END_CLAUSES = new HashSet(); - private static final Set LOGICAL = new HashSet(); - private static final Set QUANTIFIERS = new HashSet(); - private static final Set DML = new HashSet(); - private static final Set MISC = new HashSet(); + private static final Set BEGIN_CLAUSES = new HashSet(); + private static final Set END_CLAUSES = new HashSet(); + private static final Set LOGICAL = new HashSet(); + private static final Set QUANTIFIERS = new HashSet(); + private static final Set DML = new HashSet(); + private static final Set MISC = new HashSet(); static { BEGIN_CLAUSES.add( "left" ); @@ -101,8 +101,8 @@ public class BasicFormatterImpl implements Formatter { boolean afterInsert = false; int inFunction = 0; int parensSinceSelect = 0; - private LinkedList parenCounts = new LinkedList(); - private LinkedList afterByOrFromOrSelects = new LinkedList(); + private LinkedList parenCounts = new LinkedList(); + private LinkedList afterByOrFromOrSelects = new LinkedList(); int indent = 1; @@ -273,11 +273,12 @@ public class BasicFormatterImpl implements Formatter { } } + @SuppressWarnings( {"UnnecessaryBoxing"}) private void select() { out(); indent++; newline(); - parenCounts.addLast( new Integer( parensSinceSelect ) ); + parenCounts.addLast( Integer.valueOf( parensSinceSelect ) ); afterByOrFromOrSelects.addLast( Boolean.valueOf( afterByOrSetOrFromOrSelect ) ); parensSinceSelect = 0; afterByOrSetOrFromOrSelect = true; @@ -330,12 +331,13 @@ public class BasicFormatterImpl implements Formatter { afterValues = true; } + @SuppressWarnings( {"UnnecessaryUnboxing"}) private void closeParen() { parensSinceSelect--; if ( parensSinceSelect < 0 ) { indent--; - parensSinceSelect = ( ( Integer ) parenCounts.removeLast() ).intValue(); - afterByOrSetOrFromOrSelect = ( ( Boolean ) afterByOrFromOrSelects.removeLast() ).booleanValue(); + parensSinceSelect = parenCounts.removeLast().intValue(); + afterByOrSetOrFromOrSelect = afterByOrFromOrSelects.removeLast().booleanValue(); } if ( inFunction > 0 ) { inFunction--; diff --git a/hibernate-core/src/main/java/org/hibernate/jdbc/util/DDLFormatterImpl.java b/hibernate-core/src/main/java/org/hibernate/engine/jdbc/internal/DDLFormatterImpl.java similarity index 96% rename from hibernate-core/src/main/java/org/hibernate/jdbc/util/DDLFormatterImpl.java rename to hibernate-core/src/main/java/org/hibernate/engine/jdbc/internal/DDLFormatterImpl.java index e3a06dbaf3..52ba4fc71a 100755 --- a/hibernate-core/src/main/java/org/hibernate/jdbc/util/DDLFormatterImpl.java +++ b/hibernate-core/src/main/java/org/hibernate/engine/jdbc/internal/DDLFormatterImpl.java @@ -1,10 +1,10 @@ /* * Hibernate, Relational Persistence for Idiomatic Java * - * Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as + * Copyright (c) 2008-2011, Red Hat Inc. or third-party contributors as * indicated by the @author tags or express copyright attribution * statements applied by the authors. All third-party contributions are - * distributed under license by Red Hat Middleware LLC. + * distributed under license by Red Hat Inc. * * This copyrighted material is made available to anyone wishing to use, modify, * copy, or redistribute it subject to the terms and conditions of the GNU @@ -20,9 +20,8 @@ * Free Software Foundation, Inc. * 51 Franklin Street, Fifth Floor * Boston, MA 02110-1301 USA - * */ -package org.hibernate.jdbc.util; +package org.hibernate.engine.jdbc.internal; import java.util.StringTokenizer; diff --git a/hibernate-core/src/main/java/org/hibernate/jdbc/util/FormatStyle.java b/hibernate-core/src/main/java/org/hibernate/engine/jdbc/internal/FormatStyle.java similarity index 65% rename from hibernate-core/src/main/java/org/hibernate/jdbc/util/FormatStyle.java rename to hibernate-core/src/main/java/org/hibernate/engine/jdbc/internal/FormatStyle.java index 00da9d4e50..260d4c601a 100644 --- a/hibernate-core/src/main/java/org/hibernate/jdbc/util/FormatStyle.java +++ b/hibernate-core/src/main/java/org/hibernate/engine/jdbc/internal/FormatStyle.java @@ -1,10 +1,10 @@ /* * Hibernate, Relational Persistence for Idiomatic Java * - * Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as + * Copyright (c) 2008-2011, Red Hat Inc. or third-party contributors as * indicated by the @author tags or express copyright attribution * statements applied by the authors. All third-party contributions are - * distributed under license by Red Hat Middleware LLC. + * distributed under license by Red Hat Inc. * * This copyrighted material is made available to anyone wishing to use, modify, * copy, or redistribute it subject to the terms and conditions of the GNU @@ -20,19 +20,18 @@ * Free Software Foundation, Inc. * 51 Franklin Street, Fifth Floor * Boston, MA 02110-1301 USA - * */ -package org.hibernate.jdbc.util; +package org.hibernate.engine.jdbc.internal; /** * Represents the the understood types or styles of formatting. * * @author Steve Ebersole */ -public class FormatStyle { - public static final FormatStyle BASIC = new FormatStyle( "basic", new BasicFormatterImpl() ); - public static final FormatStyle DDL = new FormatStyle( "ddl", new DDLFormatterImpl() ); - public static final FormatStyle NONE = new FormatStyle( "none", new NoFormatImpl() ); +public enum FormatStyle { + BASIC( "basic", new BasicFormatterImpl() ), + DDL( "ddl", new DDLFormatterImpl() ), + NONE( "none", new NoFormatImpl() ); private final String name; private final Formatter formatter; @@ -50,24 +49,6 @@ public class FormatStyle { return formatter; } - public boolean equals(Object o) { - if ( this == o ) { - return true; - } - if ( o == null || getClass() != o.getClass() ) { - return false; - } - - FormatStyle that = ( FormatStyle ) o; - - return name.equals( that.name ); - - } - - public int hashCode() { - return name.hashCode(); - } - private static class NoFormatImpl implements Formatter { public String format(String source) { return source; diff --git a/hibernate-core/src/main/java/org/hibernate/jdbc/util/Formatter.java b/hibernate-core/src/main/java/org/hibernate/engine/jdbc/internal/Formatter.java similarity index 78% rename from hibernate-core/src/main/java/org/hibernate/jdbc/util/Formatter.java rename to hibernate-core/src/main/java/org/hibernate/engine/jdbc/internal/Formatter.java index 2e43de74c7..3d9248c876 100644 --- a/hibernate-core/src/main/java/org/hibernate/jdbc/util/Formatter.java +++ b/hibernate-core/src/main/java/org/hibernate/engine/jdbc/internal/Formatter.java @@ -1,10 +1,10 @@ /* * Hibernate, Relational Persistence for Idiomatic Java * - * Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as + * Copyright (c) 2008-2011, Red Hat Inc. or third-party contributors as * indicated by the @author tags or express copyright attribution * statements applied by the authors. All third-party contributions are - * distributed under license by Red Hat Middleware LLC. + * distributed under license by Red Hat Inc. * * This copyrighted material is made available to anyone wishing to use, modify, * copy, or redistribute it subject to the terms and conditions of the GNU @@ -20,9 +20,8 @@ * Free Software Foundation, Inc. * 51 Franklin Street, Fifth Floor * Boston, MA 02110-1301 USA - * */ -package org.hibernate.jdbc.util; +package org.hibernate.engine.jdbc.internal; /** * Formatter contract @@ -30,5 +29,12 @@ package org.hibernate.jdbc.util; * @author Steve Ebersole */ public interface Formatter { + /** + * Format the source SQL string. + * + * @param source The original SQL string + * + * @return The formatted version + */ public String format(String source); } diff --git a/hibernate-core/src/main/java/org/hibernate/engine/jdbc/internal/JdbcCoordinatorImpl.java b/hibernate-core/src/main/java/org/hibernate/engine/jdbc/internal/JdbcCoordinatorImpl.java index dbd92ad62b..3a217786e7 100644 --- a/hibernate-core/src/main/java/org/hibernate/engine/jdbc/internal/JdbcCoordinatorImpl.java +++ b/hibernate-core/src/main/java/org/hibernate/engine/jdbc/internal/JdbcCoordinatorImpl.java @@ -30,7 +30,7 @@ import org.hibernate.engine.jdbc.batch.spi.BatchBuilder; import org.hibernate.engine.jdbc.batch.spi.BatchKey; import org.hibernate.engine.jdbc.spi.JdbcCoordinator; import org.hibernate.engine.jdbc.spi.LogicalConnectionImplementor; -import org.hibernate.engine.jdbc.spi.SQLExceptionHelper; +import org.hibernate.engine.jdbc.spi.SqlExceptionHelper; import org.hibernate.engine.jdbc.spi.StatementPreparer; import org.hibernate.engine.transaction.internal.TransactionCoordinatorImpl; import org.hibernate.engine.transaction.spi.TransactionContext; @@ -100,7 +100,7 @@ public class JdbcCoordinatorImpl implements JdbcCoordinator { return sessionFactory().getServiceRegistry().getService( BatchBuilder.class ); } - private SQLExceptionHelper sqlExceptionHelper() { + private SqlExceptionHelper sqlExceptionHelper() { return transactionEnvironment().getJdbcServices().getSqlExceptionHelper(); } diff --git a/hibernate-core/src/main/java/org/hibernate/engine/jdbc/internal/JdbcResourceRegistryImpl.java b/hibernate-core/src/main/java/org/hibernate/engine/jdbc/internal/JdbcResourceRegistryImpl.java index bcace088a0..69a5edf3ec 100644 --- a/hibernate-core/src/main/java/org/hibernate/engine/jdbc/internal/JdbcResourceRegistryImpl.java +++ b/hibernate-core/src/main/java/org/hibernate/engine/jdbc/internal/JdbcResourceRegistryImpl.java @@ -36,7 +36,7 @@ import org.slf4j.LoggerFactory; import org.hibernate.HibernateException; import org.hibernate.engine.jdbc.spi.JdbcWrapper; -import org.hibernate.engine.jdbc.spi.SQLExceptionHelper; +import org.hibernate.engine.jdbc.spi.SqlExceptionHelper; import org.hibernate.engine.jdbc.spi.JdbcResourceRegistry; import org.hibernate.engine.jdbc.spi.InvalidatableWrapper; @@ -50,11 +50,11 @@ public class JdbcResourceRegistryImpl implements JdbcResourceRegistry { private final HashMap> xref = new HashMap>(); private final Set unassociatedResultSets = new HashSet(); - private final SQLExceptionHelper exceptionHelper; + private final SqlExceptionHelper exceptionHelper; private Statement lastQuery; - public JdbcResourceRegistryImpl(SQLExceptionHelper exceptionHelper) { + public JdbcResourceRegistryImpl(SqlExceptionHelper exceptionHelper) { this.exceptionHelper = exceptionHelper; } diff --git a/hibernate-core/src/main/java/org/hibernate/engine/jdbc/internal/JdbcServicesImpl.java b/hibernate-core/src/main/java/org/hibernate/engine/jdbc/internal/JdbcServicesImpl.java index e5585eab4d..a32cd6560d 100644 --- a/hibernate-core/src/main/java/org/hibernate/engine/jdbc/internal/JdbcServicesImpl.java +++ b/hibernate-core/src/main/java/org/hibernate/engine/jdbc/internal/JdbcServicesImpl.java @@ -38,19 +38,17 @@ import org.slf4j.LoggerFactory; import org.hibernate.cfg.Environment; import org.hibernate.dialect.Dialect; +import org.hibernate.engine.jdbc.spi.SqlStatementLogger; import org.hibernate.service.jdbc.connections.spi.ConnectionProvider; import org.hibernate.service.jdbc.dialect.spi.DialectFactory; import org.hibernate.engine.jdbc.spi.ExtractedDatabaseMetaData; import org.hibernate.engine.jdbc.spi.JdbcServices; -import org.hibernate.engine.jdbc.spi.SQLExceptionHelper; -import org.hibernate.engine.jdbc.spi.SQLStatementLogger; +import org.hibernate.engine.jdbc.spi.SqlExceptionHelper; import org.hibernate.engine.jdbc.spi.SchemaNameResolver; import org.hibernate.internal.util.config.ConfigurationHelper; -import org.hibernate.internal.util.jdbc.TypeInfo; import org.hibernate.service.spi.Configurable; import org.hibernate.service.spi.InjectService; import org.hibernate.util.ReflectHelper; -import org.hibernate.internal.util.jdbc.TypeInfoExtracter; /** * Standard implementation of the {@link JdbcServices} contract @@ -75,8 +73,8 @@ public class JdbcServicesImpl implements JdbcServices, Configurable { } private Dialect dialect; - private SQLStatementLogger sqlStatementLogger; - private SQLExceptionHelper sqlExceptionHelper; + private SqlStatementLogger sqlStatementLogger; + private SqlExceptionHelper sqlExceptionHelper; private ExtractedDatabaseMetaData extractedMetaDataSupport; public void configure(Map configValues) { @@ -167,8 +165,8 @@ public class JdbcServicesImpl implements JdbcServices, Configurable { final boolean formatSQL = ConfigurationHelper.getBoolean( Environment.FORMAT_SQL, configValues, false ); this.dialect = dialect; - this.sqlStatementLogger = new SQLStatementLogger( showSQL, formatSQL ); - this.sqlExceptionHelper = new SQLExceptionHelper( dialect.buildSQLExceptionConverter() ); + this.sqlStatementLogger = new SqlStatementLogger( showSQL, formatSQL ); + this.sqlExceptionHelper = new SqlExceptionHelper( dialect.buildSQLExceptionConverter() ); this.extractedMetaDataSupport = new ExtractedDatabaseMetaDataImpl( metaSupportsScrollable, metaSupportsGetGeneratedKeys, @@ -321,11 +319,11 @@ public class JdbcServicesImpl implements JdbcServices, Configurable { return connectionProvider; } - public SQLStatementLogger getSqlStatementLogger() { + public SqlStatementLogger getSqlStatementLogger() { return sqlStatementLogger; } - public SQLExceptionHelper getSqlExceptionHelper() { + public SqlExceptionHelper getSqlExceptionHelper() { return sqlExceptionHelper; } diff --git a/hibernate-core/src/main/java/org/hibernate/engine/jdbc/internal/StatementPreparerImpl.java b/hibernate-core/src/main/java/org/hibernate/engine/jdbc/internal/StatementPreparerImpl.java index ed4fa259b0..ff26f46259 100644 --- a/hibernate-core/src/main/java/org/hibernate/engine/jdbc/internal/StatementPreparerImpl.java +++ b/hibernate-core/src/main/java/org/hibernate/engine/jdbc/internal/StatementPreparerImpl.java @@ -28,7 +28,7 @@ import org.hibernate.ScrollMode; import org.hibernate.TransactionException; import org.hibernate.cfg.Settings; import org.hibernate.engine.jdbc.spi.LogicalConnectionImplementor; -import org.hibernate.engine.jdbc.spi.SQLExceptionHelper; +import org.hibernate.engine.jdbc.spi.SqlExceptionHelper; import org.hibernate.engine.jdbc.spi.StatementPreparer; import java.sql.Connection; @@ -59,7 +59,7 @@ class StatementPreparerImpl implements StatementPreparer { return jdbcCoordinator.getLogicalConnection(); } - protected final SQLExceptionHelper sqlExceptionHelper() { + protected final SqlExceptionHelper sqlExceptionHelper() { return jdbcCoordinator.getTransactionCoordinator() .getTransactionContext() .getTransactionEnvironment() diff --git a/hibernate-core/src/main/java/org/hibernate/internal/util/jdbc/TypeInfo.java b/hibernate-core/src/main/java/org/hibernate/engine/jdbc/internal/TypeInfo.java similarity index 98% rename from hibernate-core/src/main/java/org/hibernate/internal/util/jdbc/TypeInfo.java rename to hibernate-core/src/main/java/org/hibernate/engine/jdbc/internal/TypeInfo.java index 543913df56..b84fe7b5dd 100644 --- a/hibernate-core/src/main/java/org/hibernate/internal/util/jdbc/TypeInfo.java +++ b/hibernate-core/src/main/java/org/hibernate/engine/jdbc/internal/TypeInfo.java @@ -21,7 +21,7 @@ * 51 Franklin Street, Fifth Floor * Boston, MA 02110-1301 USA */ -package org.hibernate.internal.util.jdbc; +package org.hibernate.engine.jdbc.internal; /** * Models type info extracted from {@link java.sql.DatabaseMetaData#getTypeInfo()} diff --git a/hibernate-core/src/main/java/org/hibernate/internal/util/jdbc/TypeInfoExtracter.java b/hibernate-core/src/main/java/org/hibernate/engine/jdbc/internal/TypeInfoExtracter.java similarity index 98% rename from hibernate-core/src/main/java/org/hibernate/internal/util/jdbc/TypeInfoExtracter.java rename to hibernate-core/src/main/java/org/hibernate/engine/jdbc/internal/TypeInfoExtracter.java index e39cd086eb..cac3401e4e 100644 --- a/hibernate-core/src/main/java/org/hibernate/internal/util/jdbc/TypeInfoExtracter.java +++ b/hibernate-core/src/main/java/org/hibernate/engine/jdbc/internal/TypeInfoExtracter.java @@ -21,7 +21,7 @@ * 51 Franklin Street, Fifth Floor * Boston, MA 02110-1301 USA */ -package org.hibernate.internal.util.jdbc; +package org.hibernate.engine.jdbc.internal; import java.sql.DatabaseMetaData; import java.sql.ResultSet; diff --git a/hibernate-core/src/main/java/org/hibernate/internal/util/jdbc/TypeNullability.java b/hibernate-core/src/main/java/org/hibernate/engine/jdbc/internal/TypeNullability.java similarity index 98% rename from hibernate-core/src/main/java/org/hibernate/internal/util/jdbc/TypeNullability.java rename to hibernate-core/src/main/java/org/hibernate/engine/jdbc/internal/TypeNullability.java index 2dad8be345..cdbfb04e7c 100644 --- a/hibernate-core/src/main/java/org/hibernate/internal/util/jdbc/TypeNullability.java +++ b/hibernate-core/src/main/java/org/hibernate/engine/jdbc/internal/TypeNullability.java @@ -21,7 +21,7 @@ * 51 Franklin Street, Fifth Floor * Boston, MA 02110-1301 USA */ -package org.hibernate.internal.util.jdbc; +package org.hibernate.engine.jdbc.internal; import java.sql.DatabaseMetaData; diff --git a/hibernate-core/src/main/java/org/hibernate/internal/util/jdbc/TypeSearchability.java b/hibernate-core/src/main/java/org/hibernate/engine/jdbc/internal/TypeSearchability.java similarity index 98% rename from hibernate-core/src/main/java/org/hibernate/internal/util/jdbc/TypeSearchability.java rename to hibernate-core/src/main/java/org/hibernate/engine/jdbc/internal/TypeSearchability.java index 555524f62f..96aef2e42d 100644 --- a/hibernate-core/src/main/java/org/hibernate/internal/util/jdbc/TypeSearchability.java +++ b/hibernate-core/src/main/java/org/hibernate/engine/jdbc/internal/TypeSearchability.java @@ -21,7 +21,7 @@ * 51 Franklin Street, Fifth Floor * Boston, MA 02110-1301 USA */ -package org.hibernate.internal.util.jdbc; +package org.hibernate.engine.jdbc.internal; import java.sql.DatabaseMetaData; diff --git a/hibernate-core/src/main/java/org/hibernate/engine/jdbc/spi/ExtractedDatabaseMetaData.java b/hibernate-core/src/main/java/org/hibernate/engine/jdbc/spi/ExtractedDatabaseMetaData.java index 2a9cda5a1d..10bfe61040 100644 --- a/hibernate-core/src/main/java/org/hibernate/engine/jdbc/spi/ExtractedDatabaseMetaData.java +++ b/hibernate-core/src/main/java/org/hibernate/engine/jdbc/spi/ExtractedDatabaseMetaData.java @@ -26,7 +26,7 @@ package org.hibernate.engine.jdbc.spi; import java.util.LinkedHashSet; import java.util.Set; -import org.hibernate.internal.util.jdbc.TypeInfo; +import org.hibernate.engine.jdbc.internal.TypeInfo; /** * Information extracted from {@link java.sql.DatabaseMetaData} regarding what the JDBC driver reports as diff --git a/hibernate-core/src/main/java/org/hibernate/engine/jdbc/spi/JdbcServices.java b/hibernate-core/src/main/java/org/hibernate/engine/jdbc/spi/JdbcServices.java index 9a5747996d..6a25234082 100644 --- a/hibernate-core/src/main/java/org/hibernate/engine/jdbc/spi/JdbcServices.java +++ b/hibernate-core/src/main/java/org/hibernate/engine/jdbc/spi/JdbcServices.java @@ -55,14 +55,14 @@ public interface JdbcServices extends Service { * * @return The SQL statement logger. */ - public SQLStatementLogger getSqlStatementLogger(); + public SqlStatementLogger getSqlStatementLogger(); /** * Obtain service for dealing with exceptions. * * @return The exception helper service. */ - public SQLExceptionHelper getSqlExceptionHelper(); + public SqlExceptionHelper getSqlExceptionHelper(); /** * Obtain infomration about supported behavior reported by the JDBC driver. diff --git a/hibernate-core/src/main/java/org/hibernate/engine/jdbc/spi/SQLExceptionHelper.java b/hibernate-core/src/main/java/org/hibernate/engine/jdbc/spi/SqlExceptionHelper.java similarity index 96% rename from hibernate-core/src/main/java/org/hibernate/engine/jdbc/spi/SQLExceptionHelper.java rename to hibernate-core/src/main/java/org/hibernate/engine/jdbc/spi/SqlExceptionHelper.java index 0db12c826b..69885d8f53 100644 --- a/hibernate-core/src/main/java/org/hibernate/engine/jdbc/spi/SQLExceptionHelper.java +++ b/hibernate-core/src/main/java/org/hibernate/engine/jdbc/spi/SqlExceptionHelper.java @@ -42,8 +42,8 @@ import org.hibernate.util.StringHelper; * * @author Steve Ebersole */ -public class SQLExceptionHelper implements Serializable { - private static final Logger log = LoggerFactory.getLogger( SQLExceptionHelper.class ); +public class SqlExceptionHelper implements Serializable { + private static final Logger log = LoggerFactory.getLogger( SqlExceptionHelper.class ); public static final String DEFAULT_EXCEPTION_MSG = "SQL Exception"; public static final String DEFAULT_WARNING_MSG = "SQL Warning"; @@ -61,7 +61,7 @@ public class SQLExceptionHelper implements Serializable { /** * Create an exception helper with a default exception converter. */ - public SQLExceptionHelper() { + public SqlExceptionHelper() { sqlExceptionConverter = DEFAULT_CONVERTER; } @@ -70,7 +70,7 @@ public class SQLExceptionHelper implements Serializable { * * @param sqlExceptionConverter The exception converter to use. */ - public SQLExceptionHelper(SQLExceptionConverter sqlExceptionConverter) { + public SqlExceptionHelper(SQLExceptionConverter sqlExceptionConverter) { this.sqlExceptionConverter = sqlExceptionConverter; } diff --git a/hibernate-core/src/main/java/org/hibernate/engine/jdbc/spi/SQLStatementLogger.java b/hibernate-core/src/main/java/org/hibernate/engine/jdbc/spi/SqlStatementLogger.java similarity index 86% rename from hibernate-core/src/main/java/org/hibernate/engine/jdbc/spi/SQLStatementLogger.java rename to hibernate-core/src/main/java/org/hibernate/engine/jdbc/spi/SqlStatementLogger.java index 5be6dd39ce..be469d9bb7 100644 --- a/hibernate-core/src/main/java/org/hibernate/engine/jdbc/spi/SQLStatementLogger.java +++ b/hibernate-core/src/main/java/org/hibernate/engine/jdbc/spi/SqlStatementLogger.java @@ -26,34 +26,34 @@ package org.hibernate.engine.jdbc.spi; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import org.hibernate.jdbc.util.FormatStyle; -import org.hibernate.jdbc.util.Formatter; +import org.hibernate.engine.jdbc.internal.FormatStyle; +import org.hibernate.engine.jdbc.internal.Formatter; /** * Centralize logging for SQL statements. * * @author Steve Ebersole */ -public class SQLStatementLogger { - private static final Logger log = LoggerFactory.getLogger( SQLStatementLogger.class ); +public class SqlStatementLogger { + private static final Logger log = LoggerFactory.getLogger( SqlStatementLogger.class ); private boolean logToStdout; private boolean format; /** - * Constructs a new SQLStatementLogger instance. + * Constructs a new SqlStatementLogger instance. */ - public SQLStatementLogger() { + public SqlStatementLogger() { this( false, false ); } /** - * Constructs a new SQLStatementLogger instance. + * Constructs a new SqlStatementLogger instance. * * @param logToStdout Should we log to STDOUT in addition to our internal logger. * @param format Should we format the statements prior to logging */ - public SQLStatementLogger(boolean logToStdout, boolean format) { + public SqlStatementLogger(boolean logToStdout, boolean format) { this.logToStdout = logToStdout; this.format = format; } diff --git a/hibernate-core/src/main/java/org/hibernate/engine/transaction/internal/jdbc/JdbcIsolationDelegate.java b/hibernate-core/src/main/java/org/hibernate/engine/transaction/internal/jdbc/JdbcIsolationDelegate.java index f00fbf55ca..36269665ce 100644 --- a/hibernate-core/src/main/java/org/hibernate/engine/transaction/internal/jdbc/JdbcIsolationDelegate.java +++ b/hibernate-core/src/main/java/org/hibernate/engine/transaction/internal/jdbc/JdbcIsolationDelegate.java @@ -31,7 +31,7 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.hibernate.HibernateException; -import org.hibernate.engine.jdbc.spi.SQLExceptionHelper; +import org.hibernate.engine.jdbc.spi.SqlExceptionHelper; import org.hibernate.engine.transaction.spi.IsolationDelegate; import org.hibernate.engine.transaction.spi.TransactionCoordinator; import org.hibernate.jdbc.ReturningWork; @@ -56,7 +56,7 @@ public class JdbcIsolationDelegate implements IsolationDelegate { return transactionCoordinator.getJdbcCoordinator().getLogicalConnection().getJdbcServices().getConnectionProvider(); } - protected SQLExceptionHelper sqlExceptionHelper() { + protected SqlExceptionHelper sqlExceptionHelper() { return transactionCoordinator.getJdbcCoordinator().getLogicalConnection().getJdbcServices().getSqlExceptionHelper(); } diff --git a/hibernate-core/src/main/java/org/hibernate/engine/transaction/internal/jta/JtaIsolationDelegate.java b/hibernate-core/src/main/java/org/hibernate/engine/transaction/internal/jta/JtaIsolationDelegate.java index 42bcfa9966..aeab29e538 100644 --- a/hibernate-core/src/main/java/org/hibernate/engine/transaction/internal/jta/JtaIsolationDelegate.java +++ b/hibernate-core/src/main/java/org/hibernate/engine/transaction/internal/jta/JtaIsolationDelegate.java @@ -34,7 +34,7 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.hibernate.HibernateException; -import org.hibernate.engine.jdbc.spi.SQLExceptionHelper; +import org.hibernate.engine.jdbc.spi.SqlExceptionHelper; import org.hibernate.engine.transaction.spi.IsolationDelegate; import org.hibernate.engine.transaction.spi.TransactionCoordinator; import org.hibernate.jdbc.ReturningWork; @@ -69,7 +69,7 @@ public class JtaIsolationDelegate implements IsolationDelegate { .getConnectionProvider(); } - protected SQLExceptionHelper sqlExceptionHelper() { + protected SqlExceptionHelper sqlExceptionHelper() { return transactionCoordinator.getTransactionContext() .getTransactionEnvironment() .getJdbcServices() diff --git a/hibernate-core/src/main/java/org/hibernate/id/MultipleHiLoPerTableGenerator.java b/hibernate-core/src/main/java/org/hibernate/id/MultipleHiLoPerTableGenerator.java index 265c0ae216..f70535534b 100644 --- a/hibernate-core/src/main/java/org/hibernate/id/MultipleHiLoPerTableGenerator.java +++ b/hibernate-core/src/main/java/org/hibernate/id/MultipleHiLoPerTableGenerator.java @@ -29,13 +29,13 @@ import org.hibernate.MappingException; import org.hibernate.cfg.ObjectNameNormalizer; import org.hibernate.dialect.Dialect; import org.hibernate.engine.SessionImplementor; +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.jdbc.spi.SqlStatementLogger; import org.hibernate.id.enhanced.AccessCallback; import org.hibernate.id.enhanced.OptimizerFactory; import org.hibernate.internal.util.config.ConfigurationHelper; import org.hibernate.jdbc.ReturningWork; -import org.hibernate.jdbc.util.FormatStyle; import org.hibernate.mapping.Table; import org.hibernate.type.Type; import org.slf4j.Logger; @@ -150,7 +150,7 @@ public class MultipleHiLoPerTableGenerator implements PersistentIdentifierGenera @Override public IntegralDataTypeHolder execute(Connection connection) throws SQLException { IntegralDataTypeHolder value = IdentifierGeneratorHelper.getIntegralDataTypeHolder( returnClass ); - SQLStatementLogger statementLogger = session + SqlStatementLogger statementLogger = session .getFactory() .getServiceRegistry() .getService( JdbcServices.class ) diff --git a/hibernate-core/src/main/java/org/hibernate/id/TableGenerator.java b/hibernate-core/src/main/java/org/hibernate/id/TableGenerator.java index 1c8019b5df..fa2790142a 100644 --- a/hibernate-core/src/main/java/org/hibernate/id/TableGenerator.java +++ b/hibernate-core/src/main/java/org/hibernate/id/TableGenerator.java @@ -28,11 +28,11 @@ import org.hibernate.LockMode; import org.hibernate.cfg.ObjectNameNormalizer; import org.hibernate.dialect.Dialect; import org.hibernate.engine.SessionImplementor; +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.jdbc.spi.SqlStatementLogger; import org.hibernate.internal.util.config.ConfigurationHelper; import org.hibernate.jdbc.ReturningWork; -import org.hibernate.jdbc.util.FormatStyle; import org.hibernate.mapping.Table; import org.hibernate.type.Type; import org.slf4j.Logger; @@ -139,7 +139,7 @@ public class TableGenerator implements PersistentIdentifierGenerator, Configurab } protected IntegralDataTypeHolder generateHolder(SessionImplementor session) { - final SQLStatementLogger statementLogger = session + final SqlStatementLogger statementLogger = session .getFactory() .getServiceRegistry() .getService( JdbcServices.class ) 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 b2bc06083d..3c704095eb 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 @@ -32,14 +32,14 @@ import org.hibernate.cfg.ObjectNameNormalizer; import org.hibernate.dialect.Dialect; import org.hibernate.engine.SessionImplementor; import org.hibernate.engine.jdbc.spi.JdbcServices; -import org.hibernate.engine.jdbc.spi.SQLStatementLogger; +import org.hibernate.engine.jdbc.spi.SqlStatementLogger; import org.hibernate.id.Configurable; import org.hibernate.id.IdentifierGeneratorHelper; import org.hibernate.id.IntegralDataTypeHolder; import org.hibernate.id.PersistentIdentifierGenerator; import org.hibernate.internal.util.config.ConfigurationHelper; +import org.hibernate.engine.jdbc.internal.FormatStyle; import org.hibernate.jdbc.ReturningWork; -import org.hibernate.jdbc.util.FormatStyle; import org.hibernate.mapping.Table; import org.hibernate.type.Type; import org.hibernate.util.StringHelper; @@ -455,7 +455,7 @@ public class TableGenerator implements PersistentIdentifierGenerator, Configurab @Override public synchronized Serializable generate(final SessionImplementor session, Object obj) { - final SQLStatementLogger statementLogger = session + final SqlStatementLogger statementLogger = session .getFactory() .getServiceRegistry() .getService( JdbcServices.class ) 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 cbad28cb17..2464d8858d 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 @@ -28,12 +28,12 @@ import org.hibernate.LockMode; import org.hibernate.dialect.Dialect; import org.hibernate.engine.SessionImplementor; import org.hibernate.engine.jdbc.spi.JdbcServices; -import org.hibernate.engine.jdbc.spi.SQLStatementLogger; +import org.hibernate.engine.jdbc.spi.SqlStatementLogger; import org.hibernate.id.IdentifierGenerationException; import org.hibernate.id.IdentifierGeneratorHelper; import org.hibernate.id.IntegralDataTypeHolder; import org.hibernate.jdbc.ReturningWork; -import org.hibernate.jdbc.util.FormatStyle; +import org.hibernate.engine.jdbc.internal.FormatStyle; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -118,7 +118,7 @@ public class TableStructure implements DatabaseStructure { new ReturningWork() { @Override public IntegralDataTypeHolder execute(Connection connection) throws SQLException { - final SQLStatementLogger statementLogger = session + final SqlStatementLogger statementLogger = session .getFactory() .getServiceRegistry() .getService( JdbcServices.class ) diff --git a/hibernate-core/src/main/java/org/hibernate/impl/SessionFactoryImpl.java b/hibernate-core/src/main/java/org/hibernate/impl/SessionFactoryImpl.java index 323bfcf835..9209d8cbe7 100644 --- a/hibernate-core/src/main/java/org/hibernate/impl/SessionFactoryImpl.java +++ b/hibernate-core/src/main/java/org/hibernate/impl/SessionFactoryImpl.java @@ -63,7 +63,7 @@ import org.hibernate.engine.NamedSQLQueryDefinition; import org.hibernate.engine.ResultSetMappingDefinition; import org.hibernate.engine.SessionFactoryImplementor; 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.profile.Association; import org.hibernate.engine.profile.Fetch; import org.hibernate.engine.profile.FetchProfile; @@ -80,7 +80,6 @@ import org.hibernate.mapping.PersistentClass; import org.hibernate.mapping.RootClass; import org.hibernate.metadata.ClassMetadata; import org.hibernate.metadata.CollectionMetadata; -import org.hibernate.persister.internal.PersisterFactoryImpl; import org.hibernate.persister.collection.CollectionPersister; import org.hibernate.persister.entity.EntityPersister; import org.hibernate.persister.entity.Loadable; @@ -737,7 +736,7 @@ public final class SessionFactoryImpl return getSQLExceptionHelper().getSqlExceptionConverter(); } - public SQLExceptionHelper getSQLExceptionHelper() { + public SqlExceptionHelper getSQLExceptionHelper() { return getJdbcServices().getSqlExceptionHelper(); } diff --git a/hibernate-core/src/main/java/org/hibernate/jdbc/package.html b/hibernate-core/src/main/java/org/hibernate/jdbc/package.html index 8b9aeb146c..e8e3d0d377 100755 --- a/hibernate-core/src/main/java/org/hibernate/jdbc/package.html +++ b/hibernate-core/src/main/java/org/hibernate/jdbc/package.html @@ -27,12 +27,7 @@

- This package abstracts the mechanism for dispatching SQL statements - to the database, and implements interaction with JDBC. -

-

- Concrete implementations of the Batcher interface may be - selected by specifying hibernate.jdbc.factory_class. + Essentially defines {@link Work}, {@link ReturningWork} and {@link Expectation} as well as some exceptions

diff --git a/hibernate-core/src/main/java/org/hibernate/jdbc/util/SQLStatementLogger.java b/hibernate-core/src/main/java/org/hibernate/jdbc/util/SQLStatementLogger.java deleted file mode 100644 index 5fea4adab6..0000000000 --- a/hibernate-core/src/main/java/org/hibernate/jdbc/util/SQLStatementLogger.java +++ /dev/null @@ -1,120 +0,0 @@ -/* - * Hibernate, Relational Persistence for Idiomatic Java - * - * Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as - * indicated by the @author tags or express copyright attribution - * statements applied by the authors. All third-party contributions are - * distributed under license by Red Hat Middleware LLC. - * - * This copyrighted material is made available to anyone wishing to use, modify, - * copy, or redistribute it subject to the terms and conditions of the GNU - * Lesser General Public License, as published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY - * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License - * for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this distribution; if not, write to: - * Free Software Foundation, Inc. - * 51 Franklin Street, Fifth Floor - * Boston, MA 02110-1301 USA - * - */ -package org.hibernate.jdbc.util; - -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -/** - * Centralize logging handling for SQL statements. - * - * @author Steve Ebersole - */ -public class SQLStatementLogger { - // todo : for 4.0 -// private static final Logger log = LoggerFactory.getLogger( SQLStatementLogger.class ); - // this is the legacy logging 'category'... - private static final Logger log = LoggerFactory.getLogger( "org.hibernate.SQL" ); - - private boolean logToStdout; - private boolean formatSql; - - /** - * Constructs a new SQLStatementLogger instance. - */ - public SQLStatementLogger() { - this( false, false ); - } - - /** - * Constructs a new SQLStatementLogger instance. - * - * @param logToStdout Should we log to STDOUT in addition to our internal logger. - * @param formatSql Should we format SQL ('prettify') prior to logging. - */ - public SQLStatementLogger(boolean logToStdout, boolean formatSql) { - this.logToStdout = logToStdout; - this.formatSql = formatSql; - } - - /** - * Getter for property 'logToStdout'. - * @see #setLogToStdout - * - * @return Value for property 'logToStdout'. - */ - public boolean isLogToStdout() { - return logToStdout; - } - - /** - * Setter for property 'logToStdout'. - * - * @param logToStdout Value to set for property 'logToStdout'. - */ - public void setLogToStdout(boolean logToStdout) { - this.logToStdout = logToStdout; - } - - /** - * Getter for property 'formatSql'. - * @see #setFormatSql - * - * @return Value for property 'formatSql'. - */ - public boolean isFormatSql() { - return formatSql; - } - - /** - * Setter for property 'formatSql'. - * - * @param formatSql Value to set for property 'formatSql'. - */ - public void setFormatSql(boolean formatSql) { - this.formatSql = formatSql; - } - - /** - * Log a SQL statement string. - * - * @param statement The SQL statement. - * @param style The requested formatting style. - */ - public void logStatement(String statement, FormatStyle style) { - if ( log.isDebugEnabled() || logToStdout ) { - style = determineActualStyle( style ); - statement = style.getFormatter().format( statement ); - } - log.debug( statement ); - if ( logToStdout ) { - System.out.println( "Hibernate: " + statement ); - } - } - - private FormatStyle determineActualStyle(FormatStyle style) { - return formatSql ? style : FormatStyle.NONE; - } -} diff --git a/hibernate-core/src/main/java/org/hibernate/metamodel/relational/Datatype.java b/hibernate-core/src/main/java/org/hibernate/metamodel/relational/Datatype.java index 35ef2d0a59..3b86023612 100644 --- a/hibernate-core/src/main/java/org/hibernate/metamodel/relational/Datatype.java +++ b/hibernate-core/src/main/java/org/hibernate/metamodel/relational/Datatype.java @@ -26,7 +26,7 @@ package org.hibernate.metamodel.relational; /** * Models a JDBC {@link java.sql.Types DATATYPE} * - * @todo Do we somehow link this in with {@link org.hibernate.internal.util.jdbc.TypeInfo} ? + * @todo Do we somehow link this in with {@link org.hibernate.engine.jdbc.internal.TypeInfo} ? * * @author Steve Ebersole */ diff --git a/hibernate-core/src/main/java/org/hibernate/persister/collection/AbstractCollectionPersister.java b/hibernate-core/src/main/java/org/hibernate/persister/collection/AbstractCollectionPersister.java index 9136e97486..f22134c0cc 100644 --- a/hibernate-core/src/main/java/org/hibernate/persister/collection/AbstractCollectionPersister.java +++ b/hibernate-core/src/main/java/org/hibernate/persister/collection/AbstractCollectionPersister.java @@ -46,7 +46,7 @@ import org.hibernate.engine.SessionFactoryImplementor; import org.hibernate.engine.SessionImplementor; import org.hibernate.engine.SubselectFetch; import org.hibernate.engine.jdbc.batch.internal.BasicBatchKey; -import org.hibernate.engine.jdbc.spi.SQLExceptionHelper; +import org.hibernate.engine.jdbc.spi.SqlExceptionHelper; import org.hibernate.exception.SQLExceptionConverter; import org.hibernate.id.IdentifierGenerator; import org.hibernate.jdbc.Expectation; @@ -178,7 +178,7 @@ public abstract class AbstractCollectionPersister private final String entityName; private final Dialect dialect; - private final SQLExceptionHelper sqlExceptionHelper; + private final SqlExceptionHelper sqlExceptionHelper; private final SessionFactoryImplementor factory; private final EntityPersister ownerPersister; private final IdentifierGenerator identifierGenerator; @@ -1695,7 +1695,7 @@ public abstract class AbstractCollectionPersister } // TODO: needed??? - protected SQLExceptionHelper getSQLExceptionHelper() { + protected SqlExceptionHelper getSQLExceptionHelper() { return sqlExceptionHelper; } diff --git a/hibernate-core/src/main/java/org/hibernate/tool/hbm2ddl/SchemaExport.java b/hibernate-core/src/main/java/org/hibernate/tool/hbm2ddl/SchemaExport.java index 4916f13734..f84de0bf11 100644 --- a/hibernate-core/src/main/java/org/hibernate/tool/hbm2ddl/SchemaExport.java +++ b/hibernate-core/src/main/java/org/hibernate/tool/hbm2ddl/SchemaExport.java @@ -50,11 +50,11 @@ import org.hibernate.cfg.Configuration; import org.hibernate.cfg.Environment; import org.hibernate.cfg.NamingStrategy; import org.hibernate.dialect.Dialect; +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.jdbc.spi.SqlStatementLogger; import org.hibernate.internal.util.config.ConfigurationHelper; -import org.hibernate.jdbc.util.FormatStyle; -import org.hibernate.jdbc.util.Formatter; +import org.hibernate.engine.jdbc.internal.Formatter; import org.hibernate.util.ConfigHelper; import org.hibernate.util.JDBCExceptionReporter; import org.hibernate.util.ReflectHelper; @@ -79,7 +79,7 @@ public class SchemaExport { private final List exceptions = new ArrayList(); private boolean haltOnError = false; private Formatter formatter; - private SQLStatementLogger sqlStatementLogger; + private SqlStatementLogger sqlStatementLogger; private static final String DEFAULT_IMPORT_FILE = "/import.sql"; /** diff --git a/hibernate-core/src/main/java/org/hibernate/tool/hbm2ddl/SchemaUpdate.java b/hibernate-core/src/main/java/org/hibernate/tool/hbm2ddl/SchemaUpdate.java index 09bf4db55c..94f480469e 100644 --- a/hibernate-core/src/main/java/org/hibernate/tool/hbm2ddl/SchemaUpdate.java +++ b/hibernate-core/src/main/java/org/hibernate/tool/hbm2ddl/SchemaUpdate.java @@ -39,12 +39,11 @@ import org.hibernate.JDBCException; import org.hibernate.cfg.Configuration; import org.hibernate.cfg.Environment; import org.hibernate.cfg.NamingStrategy; -import org.hibernate.cfg.Settings; import org.hibernate.dialect.Dialect; +import org.hibernate.engine.jdbc.internal.FormatStyle; +import org.hibernate.engine.jdbc.internal.Formatter; import org.hibernate.engine.jdbc.spi.JdbcServices; -import org.hibernate.jdbc.util.FormatStyle; -import org.hibernate.jdbc.util.Formatter; -import org.hibernate.engine.jdbc.spi.SQLStatementLogger; +import org.hibernate.engine.jdbc.spi.SqlStatementLogger; import org.hibernate.internal.util.config.ConfigurationHelper; import org.hibernate.util.ReflectHelper; import org.slf4j.Logger; @@ -68,7 +67,7 @@ public class SchemaUpdate { private String outputFile = null; private String delimiter; private Formatter formatter; - private SQLStatementLogger sqlStatementLogger; + private SqlStatementLogger sqlStatementLogger; public SchemaUpdate(Configuration cfg) throws HibernateException { this( cfg, cfg.getProperties() ); diff --git a/hibernate-core/src/test/java/org/hibernate/jdbc/util/BasicFormatterTest.java b/hibernate-core/src/test/java/org/hibernate/jdbc/util/BasicFormatterTest.java index 15f86ecea3..4bb27efd00 100644 --- a/hibernate-core/src/test/java/org/hibernate/jdbc/util/BasicFormatterTest.java +++ b/hibernate-core/src/test/java/org/hibernate/jdbc/util/BasicFormatterTest.java @@ -19,6 +19,8 @@ import java.util.StringTokenizer; import junit.framework.TestCase; +import org.hibernate.engine.jdbc.internal.FormatStyle; + /** * BasicFormatterTest implementation * diff --git a/hibernate-core/src/test/java/org/hibernate/test/common/BasicTestingJdbcServiceImpl.java b/hibernate-core/src/test/java/org/hibernate/test/common/BasicTestingJdbcServiceImpl.java index b4c21660f5..011a0bdd8c 100644 --- a/hibernate-core/src/test/java/org/hibernate/test/common/BasicTestingJdbcServiceImpl.java +++ b/hibernate-core/src/test/java/org/hibernate/test/common/BasicTestingJdbcServiceImpl.java @@ -29,11 +29,11 @@ import java.util.Set; import org.hibernate.dialect.Dialect; import org.hibernate.engine.jdbc.JdbcSupport; +import org.hibernate.engine.jdbc.internal.TypeInfo; import org.hibernate.engine.jdbc.spi.ExtractedDatabaseMetaData; -import org.hibernate.engine.jdbc.spi.SQLExceptionHelper; -import org.hibernate.engine.jdbc.spi.SQLStatementLogger; +import org.hibernate.engine.jdbc.spi.SqlExceptionHelper; +import org.hibernate.engine.jdbc.spi.SqlStatementLogger; import org.hibernate.engine.jdbc.spi.JdbcServices; -import org.hibernate.internal.util.jdbc.TypeInfo; import org.hibernate.service.jdbc.connections.spi.ConnectionProvider; import org.hibernate.service.spi.Stoppable; @@ -47,8 +47,8 @@ import org.hibernate.service.spi.Stoppable; public class BasicTestingJdbcServiceImpl implements JdbcServices { private ConnectionProvider connectionProvider; private Dialect dialect; - private SQLStatementLogger sqlStatementLogger; - private SQLExceptionHelper exceptionHelper; + private SqlStatementLogger sqlStatementLogger; + private SqlExceptionHelper exceptionHelper; private final ExtractedDatabaseMetaData metaDataSupport = new MetaDataSupportImpl(); @@ -62,8 +62,8 @@ public class BasicTestingJdbcServiceImpl implements JdbcServices { public void prepare(boolean allowAggressiveRelease) { connectionProvider = ConnectionProviderBuilder.buildConnectionProvider( allowAggressiveRelease ); dialect = ConnectionProviderBuilder.getCorrespondingDialect(); - sqlStatementLogger = new SQLStatementLogger( true, false ); - exceptionHelper = new SQLExceptionHelper(); + sqlStatementLogger = new SqlStatementLogger( true, false ); + exceptionHelper = new SqlExceptionHelper(); } @@ -85,11 +85,11 @@ public class BasicTestingJdbcServiceImpl implements JdbcServices { return null; } - public SQLStatementLogger getSqlStatementLogger() { + public SqlStatementLogger getSqlStatementLogger() { return sqlStatementLogger; } - public SQLExceptionHelper getSqlExceptionHelper() { + public SqlExceptionHelper getSqlExceptionHelper() { return exceptionHelper; } diff --git a/hibernate-core/src/test/java/org/hibernate/test/jdbc/TypeInfoTest.java b/hibernate-core/src/test/java/org/hibernate/test/jdbc/TypeInfoTest.java index d93f53b602..417092cfc5 100644 --- a/hibernate-core/src/test/java/org/hibernate/test/jdbc/TypeInfoTest.java +++ b/hibernate-core/src/test/java/org/hibernate/test/jdbc/TypeInfoTest.java @@ -27,8 +27,8 @@ import java.sql.Connection; import java.sql.SQLException; import java.util.LinkedHashSet; -import org.hibernate.internal.util.jdbc.TypeInfo; -import org.hibernate.internal.util.jdbc.TypeInfoExtracter; +import org.hibernate.engine.jdbc.internal.TypeInfo; +import org.hibernate.engine.jdbc.internal.TypeInfoExtracter; import org.hibernate.service.jdbc.connections.spi.ConnectionProvider; import org.hibernate.test.common.ConnectionProviderBuilder; import org.hibernate.testing.junit.UnitTestCase;