diff --git a/hibernate-core/src/main/java/org/hibernate/cfg/AnnotationBinder.java b/hibernate-core/src/main/java/org/hibernate/cfg/AnnotationBinder.java index 9ca34a3a67..315494b442 100644 --- a/hibernate-core/src/main/java/org/hibernate/cfg/AnnotationBinder.java +++ b/hibernate-core/src/main/java/org/hibernate/cfg/AnnotationBinder.java @@ -730,7 +730,7 @@ public final class AnnotationBinder { discriminatorType, discAnn, discFormulaAnn, mappings ); } - if (discAnn != null && inheritanceState.hasParents()) LOG.invalidDescriminatorAnnotation(clazzToProcess.getName()); + if (discAnn != null && inheritanceState.hasParents()) LOG.invalidDiscriminatorAnnotation( clazzToProcess.getName() ); String discrimValue = clazzToProcess.isAnnotationPresent( DiscriminatorValue.class ) ? clazzToProcess.getAnnotation( DiscriminatorValue.class ).value() : diff --git a/hibernate-core/src/main/java/org/hibernate/cfg/PropertyContainer.java b/hibernate-core/src/main/java/org/hibernate/cfg/PropertyContainer.java index b0d652f2b8..8e789d405b 100644 --- a/hibernate-core/src/main/java/org/hibernate/cfg/PropertyContainer.java +++ b/hibernate-core/src/main/java/org/hibernate/cfg/PropertyContainer.java @@ -152,8 +152,12 @@ class PropertyContainer { // the access type for this property is explicitly set to AccessType.FIELD, hence we have to // use field access for this property even if the default access type for the class is AccessType.PROPERTY AccessType accessType = AccessType.getAccessStrategy( access.value() ); - if (accessType == AccessType.FIELD) propertyAccessMap.put(property.getName(), property); - else LOG.annotationHasNoEffect(AccessType.FIELD); + if (accessType == AccessType.FIELD) { + propertyAccessMap.put(property.getName(), property); + } + else { + LOG.debug( "Placing @Access(AccessType.FIELD) on a field does not have any effect." ); + } } for ( XProperty property : propertyAccessMap.values() ) { @@ -167,8 +171,12 @@ class PropertyContainer { // see "2.3.2 Explicit Access Type" of JPA 2 spec // the access type for this property is explicitly set to AccessType.PROPERTY, hence we have to // return use method access even if the default class access type is AccessType.FIELD - if (accessType == AccessType.PROPERTY) fieldAccessMap.put(property.getName(), property); - else LOG.annotationHasNoEffect(AccessType.PROPERTY); + if (accessType == AccessType.PROPERTY) { + fieldAccessMap.put(property.getName(), property); + } + else { + LOG.debug( "Placing @Access(AccessType.PROPERTY) on a field does not have any effect." ); + } } } 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 5a475ccc43..37786ccaf5 100644 --- a/hibernate-core/src/main/java/org/hibernate/cfg/SettingsFactory.java +++ b/hibernate-core/src/main/java/org/hibernate/cfg/SettingsFactory.java @@ -89,41 +89,54 @@ public class SettingsFactory implements Serializable { settings.setJtaPlatform( serviceRegistry.getService( JtaPlatform.class ) ); boolean flushBeforeCompletion = ConfigurationHelper.getBoolean(Environment.FLUSH_BEFORE_COMPLETION, properties); - LOG.autoFlush(enabledDisabled(flushBeforeCompletion)); + LOG.debugf( "Automatic flush during beforeCompletion(): %s", enabledDisabled(flushBeforeCompletion) ); settings.setFlushBeforeCompletionEnabled(flushBeforeCompletion); boolean autoCloseSession = ConfigurationHelper.getBoolean(Environment.AUTO_CLOSE_SESSION, properties); - LOG.autoSessionClose(enabledDisabled(autoCloseSession)); + LOG.debugf( "Automatic session close at end of transaction: %s", enabledDisabled(autoCloseSession) ); settings.setAutoCloseSessionEnabled(autoCloseSession); //JDBC and connection settings: int batchSize = ConfigurationHelper.getInt(Environment.STATEMENT_BATCH_SIZE, properties, 0); - if ( !meta.supportsBatchUpdates() ) batchSize = 0; - if (batchSize>0) LOG.jdbcBatchSize(batchSize); + if ( !meta.supportsBatchUpdates() ) { + batchSize = 0; + } + if ( batchSize > 0 ) { + LOG.debugf( "JDBC batch size: %s", batchSize ); + } settings.setJdbcBatchSize(batchSize); + boolean jdbcBatchVersionedData = ConfigurationHelper.getBoolean(Environment.BATCH_VERSIONED_DATA, properties, false); - if (batchSize > 0) LOG.jdbcBatchUpdates(enabledDisabled(jdbcBatchVersionedData)); + if ( batchSize > 0 ) { + LOG.debugf( "JDBC batch updates for versioned data: %s", enabledDisabled(jdbcBatchVersionedData) ); + } settings.setJdbcBatchVersionedData(jdbcBatchVersionedData); - boolean useScrollableResultSets = ConfigurationHelper.getBoolean(Environment.USE_SCROLLABLE_RESULTSET, properties, meta.supportsScrollableResults()); - LOG.scrollabelResultSets(enabledDisabled(useScrollableResultSets)); + boolean useScrollableResultSets = ConfigurationHelper.getBoolean( + Environment.USE_SCROLLABLE_RESULTSET, + properties, + meta.supportsScrollableResults() + ); + LOG.debugf( "Scrollable result sets: %s", enabledDisabled(useScrollableResultSets) ); settings.setScrollableResultSetsEnabled(useScrollableResultSets); boolean wrapResultSets = ConfigurationHelper.getBoolean(Environment.WRAP_RESULT_SETS, properties, false); - LOG.wrapResultSets(enabledDisabled(wrapResultSets)); + LOG.debugf( "Wrap result sets: %s", enabledDisabled(wrapResultSets) ); settings.setWrapResultSetsEnabled(wrapResultSets); boolean useGetGeneratedKeys = ConfigurationHelper.getBoolean(Environment.USE_GET_GENERATED_KEYS, properties, meta.supportsGetGeneratedKeys()); - LOG.jdbc3GeneratedKeys(enabledDisabled(useGetGeneratedKeys)); + LOG.debugf( "JDBC3 getGeneratedKeys(): %s", enabledDisabled(useGetGeneratedKeys) ); settings.setGetGeneratedKeysEnabled(useGetGeneratedKeys); Integer statementFetchSize = ConfigurationHelper.getInteger(Environment.STATEMENT_FETCH_SIZE, properties); - if (statementFetchSize != null) LOG.jdbcResultSetFetchSize(statementFetchSize); + if (statementFetchSize != null) { + LOG.debugf( "JDBC result set fetch size: %s", statementFetchSize ); + } settings.setJdbcFetchSize(statementFetchSize); String releaseModeName = ConfigurationHelper.getString( Environment.RELEASE_CONNECTIONS, properties, "auto" ); - LOG.connectionReleaseMode(releaseModeName); + LOG.debugf( "Connection release mode: %s", releaseModeName ); ConnectionReleaseMode releaseMode; if ( "auto".equals(releaseModeName) ) { releaseMode = serviceRegistry.getService( TransactionFactory.class ).getDefaultReleaseMode(); @@ -140,53 +153,63 @@ public class SettingsFactory implements Serializable { //SQL Generation settings: - String defaultSchema = properties.getProperty(Environment.DEFAULT_SCHEMA); - String defaultCatalog = properties.getProperty(Environment.DEFAULT_CATALOG); - if (defaultSchema != null) LOG.defaultSchema(defaultSchema); - if (defaultCatalog != null) LOG.defaultCatalog(defaultCatalog); - settings.setDefaultSchemaName(defaultSchema); - settings.setDefaultCatalogName(defaultCatalog); + String defaultSchema = properties.getProperty( Environment.DEFAULT_SCHEMA ); + String defaultCatalog = properties.getProperty( Environment.DEFAULT_CATALOG ); + if ( defaultSchema != null ) { + LOG.debugf( "Default schema: %s", defaultSchema ); + } + if (defaultCatalog != null) { + LOG.debugf( "Default catalog: %s", defaultCatalog ); + } + settings.setDefaultSchemaName( defaultSchema ); + settings.setDefaultCatalogName( defaultCatalog ); + + Integer maxFetchDepth = ConfigurationHelper.getInteger( Environment.MAX_FETCH_DEPTH, properties ); + if ( maxFetchDepth != null ) { + LOG.debugf( "Maximum outer join fetch depth: %s", maxFetchDepth ); + } + settings.setMaximumFetchDepth( maxFetchDepth ); - Integer maxFetchDepth = ConfigurationHelper.getInteger(Environment.MAX_FETCH_DEPTH, properties); - if (maxFetchDepth != null) LOG.maxOuterJoinFetchDepth(maxFetchDepth); - settings.setMaximumFetchDepth(maxFetchDepth); int batchFetchSize = ConfigurationHelper.getInt(Environment.DEFAULT_BATCH_FETCH_SIZE, properties, 1); - LOG.defaultBatchFetchSize(batchFetchSize); - settings.setDefaultBatchFetchSize(batchFetchSize); + LOG.debugf( "Default batch fetch size: %s", batchFetchSize ); + settings.setDefaultBatchFetchSize( batchFetchSize ); - boolean comments = ConfigurationHelper.getBoolean(Environment.USE_SQL_COMMENTS, properties); - LOG.generateSqlWithComments(enabledDisabled(comments)); - settings.setCommentsEnabled(comments); + boolean comments = ConfigurationHelper.getBoolean( Environment.USE_SQL_COMMENTS, properties ); + LOG.debugf( "Generate SQL with comments: %s", enabledDisabled(comments) ); + settings.setCommentsEnabled( comments ); - boolean orderUpdates = ConfigurationHelper.getBoolean(Environment.ORDER_UPDATES, properties); - LOG.orderSqlUpdatesByPrimaryKey(enabledDisabled(orderUpdates)); - settings.setOrderUpdatesEnabled(orderUpdates); + boolean orderUpdates = ConfigurationHelper.getBoolean( Environment.ORDER_UPDATES, properties ); + LOG.debugf( "Order SQL updates by primary key: %s", enabledDisabled(orderUpdates) ); + settings.setOrderUpdatesEnabled( orderUpdates ); boolean orderInserts = ConfigurationHelper.getBoolean(Environment.ORDER_INSERTS, properties); - LOG.orderSqlInsertsForBatching(enabledDisabled(orderInserts)); + LOG.debugf( "Order SQL inserts for batching: %s", enabledDisabled(orderInserts) ); settings.setOrderInsertsEnabled( orderInserts ); //Query parser settings: settings.setQueryTranslatorFactory( createQueryTranslatorFactory(properties) ); - Map querySubstitutions = ConfigurationHelper.toMap(Environment.QUERY_SUBSTITUTIONS, " ,=;:\n\t\r\f", properties); - LOG.queryLanguageSubstitutions(querySubstitutions); - settings.setQuerySubstitutions(querySubstitutions); + Map querySubstitutions = ConfigurationHelper.toMap( Environment.QUERY_SUBSTITUTIONS, " ,=;:\n\t\r\f", properties ); + LOG.debugf( "Query language substitutions: %s", querySubstitutions ); + settings.setQuerySubstitutions( querySubstitutions ); boolean jpaqlCompliance = ConfigurationHelper.getBoolean( Environment.JPAQL_STRICT_COMPLIANCE, properties, false ); + LOG.debugf( "JPA-QL strict compliance: %s", enabledDisabled(jpaqlCompliance) ); settings.setStrictJPAQLCompliance( jpaqlCompliance ); - LOG.jpaQlStrictCompliance(enabledDisabled(jpaqlCompliance)); // Second-level / query cache: - boolean useSecondLevelCache = ConfigurationHelper.getBoolean(Environment.USE_SECOND_LEVEL_CACHE, properties, true); - LOG.secondLevelCache(enabledDisabled(useSecondLevelCache)); - settings.setSecondLevelCacheEnabled(useSecondLevelCache); + boolean useSecondLevelCache = ConfigurationHelper.getBoolean( Environment.USE_SECOND_LEVEL_CACHE, properties, true ); + LOG.debugf( "Second-level cache: %s", enabledDisabled(useSecondLevelCache) ); + settings.setSecondLevelCacheEnabled( useSecondLevelCache ); boolean useQueryCache = ConfigurationHelper.getBoolean(Environment.USE_QUERY_CACHE, properties); - LOG.queryCache(enabledDisabled(useQueryCache)); - settings.setQueryCacheEnabled(useQueryCache); + LOG.debugf( "Query cache: %s", enabledDisabled(useQueryCache) ); + settings.setQueryCacheEnabled( useQueryCache ); + if (useQueryCache) { + settings.setQueryCacheFactory( createQueryCacheFactory(properties) ); + } // The cache provider is needed when we either have second-level cache enabled // or query cache enabled. Note that useSecondLevelCache is enabled by default @@ -195,56 +218,65 @@ public class SettingsFactory implements Serializable { boolean useMinimalPuts = ConfigurationHelper.getBoolean( Environment.USE_MINIMAL_PUTS, properties, settings.getRegionFactory().isMinimalPutsEnabledByDefault() ); - LOG.optimizeCacheForMinimalInputs(enabledDisabled(useMinimalPuts)); - settings.setMinimalPutsEnabled(useMinimalPuts); + LOG.debugf( "Optimize cache for minimal puts: %s", enabledDisabled(useMinimalPuts) ); + settings.setMinimalPutsEnabled( useMinimalPuts ); - String prefix = properties.getProperty(Environment.CACHE_REGION_PREFIX); - if ( StringHelper.isEmpty(prefix) ) prefix=null; - if (prefix != null) LOG.cacheRegionPrefix(prefix); - settings.setCacheRegionPrefix(prefix); + String prefix = properties.getProperty( Environment.CACHE_REGION_PREFIX ); + if ( StringHelper.isEmpty(prefix) ) { + prefix=null; + } + if (prefix != null) { + LOG.debugf( "Cache region prefix: %s", prefix ); + } + settings.setCacheRegionPrefix( prefix ); - boolean useStructuredCacheEntries = ConfigurationHelper.getBoolean(Environment.USE_STRUCTURED_CACHE, properties, false); - LOG.structuredSecondLevelCacheEntries(enabledDisabled(useStructuredCacheEntries)); - settings.setStructuredCacheEntriesEnabled(useStructuredCacheEntries); + boolean useStructuredCacheEntries = ConfigurationHelper.getBoolean( Environment.USE_STRUCTURED_CACHE, properties, false ); + LOG.debugf( "Structured second-level cache entries: %s", enabledDisabled(useStructuredCacheEntries) ); + settings.setStructuredCacheEntriesEnabled( useStructuredCacheEntries ); - if (useQueryCache) settings.setQueryCacheFactory( createQueryCacheFactory(properties) ); //Statistics and logging: - boolean useStatistics = ConfigurationHelper.getBoolean(Environment.GENERATE_STATISTICS, properties); - LOG.statistics( enabledDisabled(useStatistics) ); - settings.setStatisticsEnabled(useStatistics); + boolean useStatistics = ConfigurationHelper.getBoolean( Environment.GENERATE_STATISTICS, properties ); + LOG.debugf( "Statistics: %s", enabledDisabled(useStatistics) ); + settings.setStatisticsEnabled( useStatistics ); - boolean useIdentifierRollback = ConfigurationHelper.getBoolean(Environment.USE_IDENTIFIER_ROLLBACK, properties); - LOG.deletedEntitySyntheticIdentifierRollback(enabledDisabled(useIdentifierRollback)); - settings.setIdentifierRollbackEnabled(useIdentifierRollback); + boolean useIdentifierRollback = ConfigurationHelper.getBoolean( Environment.USE_IDENTIFIER_ROLLBACK, properties ); + LOG.debugf( "Deleted entity synthetic identifier rollback: %s", enabledDisabled(useIdentifierRollback) ); + settings.setIdentifierRollbackEnabled( useIdentifierRollback ); //Schema export: - String autoSchemaExport = properties.getProperty(Environment.HBM2DDL_AUTO); - if ( "validate".equals(autoSchemaExport) ) settings.setAutoValidateSchema(true); - if ( "update".equals(autoSchemaExport) ) settings.setAutoUpdateSchema(true); - if ( "create".equals(autoSchemaExport) ) settings.setAutoCreateSchema(true); - if ( "create-drop".equals(autoSchemaExport) ) { - settings.setAutoCreateSchema(true); - settings.setAutoDropSchema(true); + String autoSchemaExport = properties.getProperty( Environment.HBM2DDL_AUTO ); + if ( "validate".equals(autoSchemaExport) ) { + settings.setAutoValidateSchema( true ); + } + if ( "update".equals(autoSchemaExport) ) { + settings.setAutoUpdateSchema( true ); + } + if ( "create".equals(autoSchemaExport) ) { + settings.setAutoCreateSchema( true ); + } + if ( "create-drop".equals( autoSchemaExport ) ) { + settings.setAutoCreateSchema( true ); + settings.setAutoDropSchema( true ); } settings.setImportFiles( properties.getProperty( Environment.HBM2DDL_IMPORT_FILES ) ); EntityMode defaultEntityMode = EntityMode.parse( properties.getProperty( Environment.DEFAULT_ENTITY_MODE ) ); - LOG.defaultEntityMode(defaultEntityMode); + LOG.debugf( "Default entity-mode: %s", defaultEntityMode ); settings.setDefaultEntityMode( defaultEntityMode ); boolean namedQueryChecking = ConfigurationHelper.getBoolean( Environment.QUERY_STARTUP_CHECKING, properties, true ); - LOG.namedQueryChecking(enabledDisabled(namedQueryChecking)); + LOG.debugf( "Named query checking : %s", enabledDisabled(namedQueryChecking) ); settings.setNamedQueryStartupCheckingEnabled( namedQueryChecking ); boolean checkNullability = ConfigurationHelper.getBoolean(Environment.CHECK_NULLABILITY, properties, true); - LOG.checkNullability(enabledDisabled(checkNullability)); + LOG.debugf( "Check Nullability in Core (should be disabled when Bean Validation is on): %s", enabledDisabled(checkNullability) ); settings.setCheckNullability(checkNullability); MultiTenancyStrategy multiTenancyStrategy = MultiTenancyStrategy.determineMultiTenancyStrategy( properties ); - LOG.debug( "multi-tenancy strategy : " + multiTenancyStrategy ); + LOG.debugf( "multi-tenancy strategy : %s", multiTenancyStrategy ); settings.setMultiTenancyStrategy( multiTenancyStrategy ); // String provider = properties.getProperty( Environment.BYTECODE_PROVIDER ); @@ -274,12 +306,12 @@ public class SettingsFactory implements Serializable { String queryCacheFactoryClassName = ConfigurationHelper.getString( Environment.QUERY_CACHE_FACTORY, properties, "org.hibernate.cache.StandardQueryCacheFactory" ); - LOG.queryCacheFactory(queryCacheFactoryClassName); + LOG.debugf( "Query cache factory: %s", queryCacheFactoryClassName ); try { return (QueryCacheFactory) ReflectHelper.classForName(queryCacheFactoryClassName).newInstance(); } - catch (Exception cnfe) { - throw new HibernateException("could not instantiate QueryCacheFactory: " + queryCacheFactoryClassName, cnfe); + catch (Exception e) { + throw new HibernateException( "could not instantiate QueryCacheFactory: " + queryCacheFactoryClassName, e ); } } @@ -297,16 +329,19 @@ public class SettingsFactory implements Serializable { if ( regionFactoryClassName == null ) { regionFactoryClassName = DEF_CACHE_REG_FACTORY; } - LOG.cacheRegionFactory( regionFactoryClassName ); + LOG.debugf( "Cache region factory : %s", regionFactoryClassName ); try { try { return (RegionFactory) ReflectHelper.classForName( regionFactoryClassName ) .getConstructor( Properties.class ) .newInstance( properties ); } - catch ( NoSuchMethodException nsme ) { + catch ( NoSuchMethodException e ) { // no constructor accepting Properties found, try no arg constructor - LOG.constructorWithPropertiesNotFound(regionFactoryClassName); + LOG.debugf( + "%s did not provide constructor accepting java.util.Properties; attempting no-arg constructor.", + regionFactoryClassName + ); return (RegionFactory) ReflectHelper.classForName( regionFactoryClassName ).newInstance(); } } @@ -319,12 +354,12 @@ public class SettingsFactory implements Serializable { String className = ConfigurationHelper.getString( Environment.QUERY_TRANSLATOR, properties, "org.hibernate.hql.ast.ASTQueryTranslatorFactory" ); - LOG.queryTranslator( className ); + LOG.debugf( "Query translator: %s", className ); try { return (QueryTranslatorFactory) ReflectHelper.classForName(className).newInstance(); } - catch (Exception cnfe) { - throw new HibernateException("could not instantiate QueryTranslatorFactory: " + className, cnfe); + catch (Exception e) { + throw new HibernateException( "could not instantiate QueryTranslatorFactory: " + className, e ); } } } diff --git a/hibernate-core/src/main/java/org/hibernate/cfg/annotations/EntityBinder.java b/hibernate-core/src/main/java/org/hibernate/cfg/annotations/EntityBinder.java index 335fdffdec..f303765bef 100644 --- a/hibernate-core/src/main/java/org/hibernate/cfg/annotations/EntityBinder.java +++ b/hibernate-core/src/main/java/org/hibernate/cfg/annotations/EntityBinder.java @@ -746,7 +746,7 @@ public class EntityBinder { //somehow keep joins() for later. //Has to do the work later because it needs persistentClass id! - LOG.addingSecondaryTableToEntity( persistentClass.getEntityName(), join.getTable().getName() ); + LOG.debugf( "Adding secondary table to entity %s -> %s", persistentClass.getEntityName(), join.getTable().getName() ); org.hibernate.annotations.Table matchingTable = findMatchingComplimentTableAnnotation( join ); if ( matchingTable != null ) { join.setSequentialSelect( FetchMode.JOIN != matchingTable.fetch() ); diff --git a/hibernate-core/src/main/java/org/hibernate/internal/CoreMessageLogger.java b/hibernate-core/src/main/java/org/hibernate/internal/CoreMessageLogger.java index d7cd094a6d..7f28b07812 100644 --- a/hibernate-core/src/main/java/org/hibernate/internal/CoreMessageLogger.java +++ b/hibernate-core/src/main/java/org/hibernate/internal/CoreMessageLogger.java @@ -23,9 +23,11 @@ */ package org.hibernate.internal; -import static org.jboss.logging.Logger.Level.ERROR; -import static org.jboss.logging.Logger.Level.INFO; -import static org.jboss.logging.Logger.Level.WARN; +import javax.naming.InvalidNameException; +import javax.naming.NameNotFoundException; +import javax.naming.NamingException; +import javax.transaction.Synchronization; +import javax.transaction.SystemException; import java.io.File; import java.io.FileNotFoundException; import java.io.IOException; @@ -34,19 +36,17 @@ import java.net.URL; import java.sql.SQLException; import java.sql.SQLWarning; import java.util.Hashtable; -import java.util.Map; import java.util.Properties; import java.util.Set; -import javax.naming.InvalidNameException; -import javax.naming.NameNotFoundException; -import javax.naming.NamingException; -import javax.transaction.Synchronization; -import javax.transaction.SystemException; -import org.hibernate.EntityMode; +import org.jboss.logging.BasicLogger; +import org.jboss.logging.Cause; +import org.jboss.logging.LogMessage; +import org.jboss.logging.Message; +import org.jboss.logging.MessageLogger; + import org.hibernate.HibernateException; import org.hibernate.cache.CacheException; -import org.hibernate.cfg.AccessType; import org.hibernate.dialect.Dialect; import org.hibernate.engine.CollectionKey; import org.hibernate.engine.SessionFactoryImplementor; @@ -57,11 +57,10 @@ import org.hibernate.service.jdbc.dialect.internal.AbstractDialectResolver; import org.hibernate.type.BasicType; import org.hibernate.type.SerializationException; import org.hibernate.type.Type; -import org.jboss.logging.BasicLogger; -import org.jboss.logging.Cause; -import org.jboss.logging.LogMessage; -import org.jboss.logging.Message; -import org.jboss.logging.MessageLogger; + +import static org.jboss.logging.Logger.Level.ERROR; +import static org.jboss.logging.Logger.Level.INFO; +import static org.jboss.logging.Logger.Level.WARN; /** * The jboss-logging {@link MessageLogger} for the hibernate-core module. It reserves message ids ranging from @@ -72,48 +71,22 @@ import org.jboss.logging.MessageLogger; @MessageLogger( projectCode = "HHH" ) public interface CoreMessageLogger extends BasicLogger { - @LogMessage( level = INFO ) - @Message( value = "Adding secondary table to entity %s -> %s", id = 1 ) - void addingSecondaryTableToEntity( String entity, - String table ); - @LogMessage( level = WARN ) @Message( value = "Already session bound on call to bind(); make sure you clean up your sessions!", id = 2 ) void alreadySessionBound(); - @LogMessage( level = WARN ) - @Message( value = "Placing @Access(AccessType.%s) on a field does not have any effect.", id = 3 ) - void annotationHasNoEffect( AccessType type ); - - @LogMessage( level = WARN ) - @Message( value = "Attempt to map column [%s] to no target column after explicit target column(s) named for FK [name=%s]", id = 4 ) - void attemptToMapColumnToNoTargetColumn( String loggableString, - String name ); - @LogMessage( level = INFO ) @Message( value = "Autocommit mode: %s", id = 6 ) void autoCommitMode( boolean autocommit ); - @LogMessage( level = INFO ) - @Message( value = "Automatic flush during beforeCompletion(): %s", id = 7 ) - void autoFlush( String enabledDisabled ); - @LogMessage( level = WARN ) @Message( value = "JTASessionContext being used with JDBCTransactionFactory; auto-flush will not operate correctly with getCurrentSession()", id = 8 ) void autoFlushWillNotWork(); - @LogMessage( level = INFO ) - @Message( value = "Automatic session close at end of transaction: %s", id = 9 ) - void autoSessionClose( String enabledDisabled ); - @LogMessage( level = INFO ) @Message( value = "On release of batch it still contained JDBC statements", id = 10 ) void batchContainedStatementsOnRelease(); - @LogMessage( level = INFO ) - @Message( value = "Batcher factory: %s", id = 11 ) - void batcherFactory( String batcherClass ); - @LogMessage( level = INFO ) @Message( value = "Bind entity %s on table %s", id = 12 ) void bindEntityOnTable( String entity, @@ -170,25 +143,10 @@ public interface CoreMessageLogger extends BasicLogger { @Message( value = "Cache provider: %s", id = 24 ) void cacheProvider( String name ); - @LogMessage( level = INFO ) - @Message( value = "Cache region factory : %s", id = 25 ) - void cacheRegionFactory( String regionFactoryClassName ); - - @LogMessage( level = INFO ) - @Message( value = "Cache region prefix: %s", id = 26 ) - void cacheRegionPrefix( String prefix ); - @LogMessage( level = WARN ) @Message( value = "Calling joinTransaction() on a non JTA EntityManager", id = 27 ) void callingJoinTransactionOnNonJtaEntityManager(); - @Message( value = "CGLIB Enhancement failed: %s", id = 28 ) - String cglibEnhancementFailed( String entityName ); - - @LogMessage( level = INFO ) - @Message( value = "Check Nullability in Core (should be disabled when Bean Validation is on): %s", id = 29 ) - void checkNullability( String enabledDisabled ); - @LogMessage( level = INFO ) @Message( value = "Cleaning up connection pool [%s]", id = 30 ) void cleaningUpConnectionPool( String url ); @@ -257,18 +215,10 @@ public interface CoreMessageLogger extends BasicLogger { @Message( value = "Connection properties: %s", id = 46 ) void connectionProperties( Properties connectionProps ); - @LogMessage( level = INFO ) - @Message( value = "Connection release mode: %s", id = 47 ) - void connectionReleaseMode( String releaseModeName ); - @LogMessage( level = INFO ) @Message( value = "Connections obtained: %s", id = 48 ) void connectionsObtained( long connectCount ); - @LogMessage( level = INFO ) - @Message( value = "%s did not provide constructor accepting java.util.Properties; attempting no-arg constructor.", id = 49 ) - void constructorWithPropertiesNotFound( String regionFactoryClassName ); - @LogMessage( level = ERROR ) @Message( value = "Container is providing a null PersistenceUnitRootUrl: discovery impossible", id = 50 ) void containerProvidingNullPersistenceUnitRootUrl(); @@ -277,9 +227,6 @@ public interface CoreMessageLogger extends BasicLogger { @Message( value = "Ignoring bag join fetch [%s] due to prior collection join fetch", id = 51 ) void containsJoinFetchedCollection( String role ); - @Message( value = "Could not close connection", id = 52 ) - Object couldNotCloseConnection(); - @LogMessage( level = INFO ) @Message( value = "Creating subcontext: %s", id = 53 ) void creatingSubcontextInfo( String intermediateContextName ); @@ -291,30 +238,10 @@ public interface CoreMessageLogger extends BasicLogger { int databaseMajorVersion, int databaseMinorVersion ); - @LogMessage( level = INFO ) - @Message( value = "Default batch fetch size: %s", id = 55 ) - void defaultBatchFetchSize( int batchFetchSize ); - - @LogMessage( level = INFO ) - @Message( value = "Default catalog: %s", id = 56 ) - void defaultCatalog( String defaultCatalog ); - - @LogMessage( level = INFO ) - @Message( value = "Default entity-mode: %s", id = 57 ) - void defaultEntityMode( EntityMode defaultEntityMode ); - - @LogMessage( level = INFO ) - @Message( value = "Default schema: %s", id = 58 ) - void defaultSchema( String defaultSchema ); - @LogMessage( level = WARN ) @Message( value = "Defining %s=true ignored in HEM", id = 59 ) void definingFlushBeforeCompletionIgnoredInHem( String flushBeforeCompletion ); - @LogMessage( level = INFO ) - @Message( value = "Deleted entity synthetic identifier rollback: %s", id = 60 ) - void deletedEntitySyntheticIdentifierRollback( String enabledDisabled ); - @LogMessage( level = WARN ) @Message( value = "Per HHH-5451 support for cglib as a bytecode provider has been deprecated.", id = 61 ) void deprecated(); @@ -336,10 +263,6 @@ public interface CoreMessageLogger extends BasicLogger { void deprecatedUuidGenerator( String name, String name2 ); - @LogMessage( level = WARN ) - @Message( value = "Dialect resolver class not found: %s", id = 66 ) - void dialectResolverNotFound( String resolverName ); - @LogMessage( level = INFO ) @Message( value = "Disallowing insert statement comment for select-identity due to Oracle driver bug", id = 67 ) void disallowingInsertStatementComment(); @@ -376,10 +299,6 @@ public interface CoreMessageLogger extends BasicLogger { @Message( value = "Found more than one , subsequent ignored", id = 74 ) void duplicateMetadata(); - @LogMessage( level = INFO ) - @Message( value = "Echoing all SQL to stdout", id = 75 ) - void echoingSql(); - @LogMessage( level = INFO ) @Message( value = "Entities deleted: %s", id = 76 ) void entitiesDeleted( long entityDeleteCount ); @@ -408,10 +327,6 @@ public interface CoreMessageLogger extends BasicLogger { @Message( value = "Entity Manager closed by someone else (%s must not be used)", id = 82 ) void entityManagerClosedBySomeoneElse( String autoCloseSession ); - @LogMessage( level = INFO ) - @Message( value = "Hibernate EntityManager %s", id = 83 ) - void entityManagerVersion( String versionString ); - @LogMessage( level = WARN ) @Message( value = "Entity [%s] is abstract-class/interface explicitly mapped as non-abstract; be sure to supply entity-names", id = 84 ) void entityMappedAsNonAbstract( String name ); @@ -438,10 +353,6 @@ public interface CoreMessageLogger extends BasicLogger { @Message( value = "Sub-resolver threw unexpected exception, continuing to next : %s", id = 89 ) void exceptionInSubResolver( String message ); - @LogMessage( level = INFO ) - @Message( value = "Executing import script: %s", id = 90 ) - void executingImportScript( String name ); - @LogMessage( level = ERROR ) @Message( value = "Expected type: %s, actual value: %s", id = 91 ) void expectedType( String name, @@ -451,10 +362,6 @@ public interface CoreMessageLogger extends BasicLogger { @Message( value = "An item was expired by the cache while it was locked (increase your cache timeout): %s", id = 92 ) void expired( Object key ); - @LogMessage( level = INFO ) - @Message( value = "Exporting generated schema to database", id = 93 ) - void exportingGeneratedSchemaToDatabase(); - @LogMessage( level = INFO ) @Message( value = "Bound factory to JNDI name: %s", id = 94 ) void factoryBoundToJndiName( String name ); @@ -520,10 +427,6 @@ public interface CoreMessageLogger extends BasicLogger { @Message( value = "Found mapping document in jar: %s", id = 109 ) void foundMappingDocument( String name ); - @LogMessage( level = INFO ) - @Message( value = "Generate SQL with comments: %s", id = 111 ) - void generateSqlWithComments( String enabledDisabled ); - @LogMessage( level = ERROR ) @Message( value = "Getters of lazy classes cannot be final: %s.%s", id = 112 ) void gettersOfLazyClassesCannotBeFinal( String entityName, @@ -599,17 +502,9 @@ public interface CoreMessageLogger extends BasicLogger { @Message( value = "InitialContext did not implement EventContext", id = 128 ) void initialContextDoesNotImplementEventContext(); - @LogMessage( level = INFO ) - @Message( value = "Instantiated TransactionManagerLookup", id = 129 ) - void instantiatedTransactionManagerLookup(); - @LogMessage( level = INFO ) @Message( value = "Instantiating explicit connection provider: %s", id = 130 ) - void instantiatingExplicitConnectinProvider( String providerClassName ); - - @LogMessage( level = INFO ) - @Message( value = "Instantiating TransactionManagerLookup: %s", id = 131 ) - void instantiatingTransactionManagerLookup( String tmLookupClass ); + void instantiatingExplicitConnectionProvider(String providerClassName); @LogMessage( level = ERROR ) @Message( value = "Array element type error\n%s", id = 132 ) @@ -617,7 +512,7 @@ public interface CoreMessageLogger extends BasicLogger { @LogMessage( level = WARN ) @Message( value = "Discriminator column has to be defined in the root entity, it will be ignored in subclass: %s", id = 133 ) - void invalidDescriminatorAnnotation( String className ); + void invalidDiscriminatorAnnotation(String className); @LogMessage( level = ERROR ) @Message( value = "Application attempted to edit read only item: %s", id = 134 ) @@ -657,25 +552,10 @@ public interface CoreMessageLogger extends BasicLogger { @Message( value = "Javassist Enhancement failed: %s", id = 142 ) String javassistEnhancementFailed( String entityName ); - @LogMessage( level = INFO ) - @Message( value = "JDBC3 getGeneratedKeys(): %s", id = 143 ) - void jdbc3GeneratedKeys( String enabledDisabled ); - @LogMessage( level = WARN ) @Message( value = "%s = false breaks the EJB3 specification", id = 144 ) void jdbcAutoCommitFalseBreaksEjb3Spec( String autocommit ); - @LogMessage( level = INFO ) - @Message( value = "JDBC batch size: %s", id = 145 ) - void jdbcBatchSize( int batchSize ); - - @LogMessage( level = INFO ) - @Message( value = "JDBC batch updates for versioned data: %s", id = 146 ) - void jdbcBatchUpdates( String enabledDisabled ); - - @Message( value = "JDBC begin failed", id = 147 ) - String jdbcBeginFailed(); - @LogMessage( level = WARN ) @Message( value = "No JDBC Driver class was specified by property %s", id = 148 ) void jdbcDriverNotSpecified( String driver ); @@ -684,10 +564,6 @@ public interface CoreMessageLogger extends BasicLogger { @Message( value = "JDBC isolation level: %s", id = 149 ) void jdbcIsolationLevel( String isolationLevelToString ); - @LogMessage( level = INFO ) - @Message( value = "JDBC result set fetch size: %s", id = 150 ) - void jdbcResultSetFetchSize( Integer statementFetchSize ); - @Message( value = "JDBC rollback failed", id = 151 ) String jdbcRollbackFailed(); @@ -708,10 +584,6 @@ public interface CoreMessageLogger extends BasicLogger { void jndiNameDoesNotHandleSessionFactoryReference( String sfJNDIName, @Cause ClassCastException e ); - @LogMessage( level = INFO ) - @Message( value = "JPA-QL strict compliance: %s", id = 156 ) - void jpaQlStrictCompliance( String enabledDisabled ); - @LogMessage( level = INFO ) @Message( value = "Lazy property fetching available for: %s", id = 157 ) void lazyPropertyFetchingAvailable( String name ); @@ -736,10 +608,6 @@ public interface CoreMessageLogger extends BasicLogger { @Message( value = "Logical connection releasing its physical connection", id = 163 ) void logicalConnectionReleasingPhysicalConnection(); - @LogMessage( level = WARN ) - @Message( value = "You should set hibernate.transaction.manager_lookup_class if cache is enabled", id = 164 ) - void managerLookupClassShouldBeSet(); - @LogMessage( level = INFO ) @Message( value = "Mapping class: %s -> %s", id = 165 ) void mappingClass( String entityName, @@ -774,10 +642,6 @@ public interface CoreMessageLogger extends BasicLogger { void mappingUnionSubclass( String entityName, String name ); - @LogMessage( level = INFO ) - @Message( value = "Maximum outer join fetch depth: %s", id = 172 ) - void maxOuterJoinFetchDepth( Integer maxFetchDepth ); - @LogMessage( level = INFO ) @Message( value = "Max query time: %sms", id = 173 ) void maxQueryTime( long queryExecutionMaxTime ); @@ -791,9 +655,6 @@ public interface CoreMessageLogger extends BasicLogger { @Message( value = "Class annotated @org.hibernate.annotations.Entity but not javax.persistence.Entity (most likely a user error): %s", id = 175 ) void missingEntityAnnotation( String className ); - @LogMessage( level = INFO ) - @Message( value = "Named query checking : %s", id = 176 ) - void namedQueryChecking( String enabledDisabled ); @LogMessage( level = ERROR ) @Message( value = "Error in named query: %s", id = 177 ) @@ -833,30 +694,14 @@ public interface CoreMessageLogger extends BasicLogger { @Message( value = "Not binding factory to JNDI, no JNDI name configured", id = 185 ) void notBindingFactoryToJndi(); - @LogMessage( level = INFO ) - @Message( value = "Obtaining TransactionManager", id = 186 ) - void obtainingTransactionManager(); - @LogMessage( level = INFO ) @Message( value = "Optimistic lock failures: %s", id = 187 ) void optimisticLockFailures( long optimisticFailureCount ); - @LogMessage( level = INFO ) - @Message( value = "Optimize cache for minimal puts: %s", id = 188 ) - void optimizeCacheForMinimalInputs( String enabledDisabled ); - @LogMessage( level = WARN ) @Message( value = "@OrderBy not allowed for an indexed collection, annotation ignored.", id = 189 ) void orderByAnnotationIndexedCollection(); - @LogMessage( level = INFO ) - @Message( value = "Order SQL inserts for batching: %s", id = 191 ) - void orderSqlInsertsForBatching( String enabledDisabled ); - - @LogMessage( level = INFO ) - @Message( value = "Order SQL updates by primary key: %s", id = 192 ) - void orderSqlUpdatesByPrimaryKey( String enabledDisabled ); - @LogMessage( level = WARN ) @Message( value = "Overriding %s is dangerous, this might break the EJB3 specification implementation", id = 193 ) void overridingTransactionStrategyDangerous( String transactionStrategy ); @@ -937,14 +782,6 @@ public interface CoreMessageLogger extends BasicLogger { @Message( value = "Queries executed to database: %s", id = 210 ) void queriesExecuted( long queryExecutionCount ); - @LogMessage( level = INFO ) - @Message( value = "Query cache: %s", id = 211 ) - void queryCache( String enabledDisabled ); - - @LogMessage( level = INFO ) - @Message( value = "Query cache factory: %s", id = 212 ) - void queryCacheFactory( String queryCacheFactoryClassName ); - @LogMessage( level = INFO ) @Message( value = "Query cache hits: %s", id = 213 ) void queryCacheHits( long queryCacheHitCount ); @@ -957,14 +794,6 @@ public interface CoreMessageLogger extends BasicLogger { @Message( value = "Query cache puts: %s", id = 215 ) void queryCachePuts( long queryCachePutCount ); - @LogMessage( level = INFO ) - @Message( value = "Query language substitutions: %s", id = 216 ) - void queryLanguageSubstitutions( Map querySubstitutions ); - - @LogMessage( level = INFO ) - @Message( value = "Query translator: %s", id = 217 ) - void queryTranslator( String className ); - @LogMessage( level = INFO ) @Message( value = "RDMSOS2200Dialect version: 1.0", id = 218 ) void rdmsOs2200Dialect(); @@ -990,10 +819,6 @@ public interface CoreMessageLogger extends BasicLogger { void recognizedObsoleteHibernateNamespace( String oldHibernateNamespace, String hibernateNamespace ); - @LogMessage( level = WARN ) - @Message( value = "Reconnecting the same connection that is already connected; should this connection have been disconnected?", id = 224 ) - void reconnectingConnectedConnection(); - @LogMessage( level = WARN ) @Message( value = "Property [%s] has been renamed to [%s]; update your properties appropriately", id = 225 ) void renamedProperty( Object propertyName, @@ -1032,18 +857,10 @@ public interface CoreMessageLogger extends BasicLogger { void scopingTypesToSessionFactoryAfterAlreadyScoped( SessionFactoryImplementor factory, SessionFactoryImplementor factory2 ); - @LogMessage( level = INFO ) - @Message( value = "Scrollable result sets: %s", id = 234 ) - void scrollabelResultSets( String enabledDisabled ); - @LogMessage( level = INFO ) @Message( value = "Searching for mapping documents in jar: %s", id = 235 ) void searchingForMappingDocuments( String name ); - @LogMessage( level = INFO ) - @Message( value = "Second-level cache: %s", id = 236 ) - void secondLevelCache( String enabledDisabled ); - @LogMessage( level = INFO ) @Message( value = "Second level cache hits: %s", id = 237 ) void secondLevelCacheHits( long secondLevelCacheHitCount ); @@ -1115,18 +932,10 @@ public interface CoreMessageLogger extends BasicLogger { @Message( value = "Statements prepared: %s", id = 253 ) void statementsPrepared( long prepareStatementCount ); - @LogMessage( level = INFO ) - @Message( value = "Statistics: %s", id = 254 ) - void statistics( String enabledDisabled ); - @LogMessage( level = INFO ) @Message( value = "Stopping service", id = 255 ) void stoppingService(); - @LogMessage( level = INFO ) - @Message( value = "Structured second-level cache entries: %s", id = 256 ) - void structuredSecondLevelCacheEntries( String enabledDisabled ); - @LogMessage( level = INFO ) @Message( value = "sub-resolver threw unexpected exception, continuing to next : %s", id = 257 ) void subResolverException( String message ); @@ -1152,17 +961,6 @@ public interface CoreMessageLogger extends BasicLogger { @Message( value = "Table not found: %s", id = 262 ) void tableNotFound( String name ); - @Message( value = "TransactionFactory class not found: %s", id = 263 ) - String transactionFactoryClassNotFound( String strategyClassName ); - - @LogMessage( level = INFO ) - @Message( value = "No TransactionManagerLookup configured (in JTA environment, use of read-write or transactional second-level cache is not recommended)", id = 264 ) - void transactionManagerLookupNotConfigured(); - - @LogMessage( level = WARN ) - @Message( value = "Transaction not available on beforeCompletion: assuming valid", id = 265 ) - void transactionNotAvailableOnBeforeCompletion(); - @LogMessage( level = INFO ) @Message( value = "Transactions: %s", id = 266 ) void transactions( long transactionCount ); @@ -1202,9 +1000,6 @@ public interface CoreMessageLogger extends BasicLogger { void unableToApplyConstraints( String className, @Cause Exception e ); - @Message( value = "JTA transaction begin failed", id = 275 ) - String unableToBeginJtaTransaction(); - @LogMessage( level = WARN ) @Message( value = "Could not bind Ejb3Configuration to JNDI", id = 276 ) void unableToBindEjb3ConfigurationToJndi( @Cause NamingException e ); @@ -1753,12 +1548,6 @@ public interface CoreMessageLogger extends BasicLogger { @Message( value = "Hibernate Validator not found: ignoring", id = 410 ) void validatorNotFound(); - @LogMessage( level = WARN ) - @Message( value = "Value mapping mismatch as part of FK [table=%s, name=%s] while adding source column [%s]", id = 411 ) - void valueMappingMismatch( String loggableString, - String name, - String loggableString2 ); - @LogMessage( level = INFO ) @Message( value = "Hibernate %s", id = 412 ) void version( String versionString ); @@ -1771,10 +1560,6 @@ public interface CoreMessageLogger extends BasicLogger { @Message( value = "Property hibernate.search.autoregister_listeners is set to false. No attempt will be made to register Hibernate Search event listeners.", id = 414 ) void willNotRegisterListeners(); - @LogMessage( level = INFO ) - @Message( value = "Wrap result sets: %s", id = 415 ) - void wrapResultSets( String enabledDisabled ); - @LogMessage( level = WARN ) @Message( value = "Write locks via update not supported for non-versioned entities [%s]", id = 416 ) void writeLocksNotSupported( String entityName ); diff --git a/hibernate-core/src/main/java/org/hibernate/metamodel/relational/ForeignKey.java b/hibernate-core/src/main/java/org/hibernate/metamodel/relational/ForeignKey.java index 2f1b770e80..4a046abe14 100644 --- a/hibernate-core/src/main/java/org/hibernate/metamodel/relational/ForeignKey.java +++ b/hibernate-core/src/main/java/org/hibernate/metamodel/relational/ForeignKey.java @@ -84,12 +84,23 @@ public class ForeignKey extends AbstractConstraint implements Constraint, Export public void addColumnMapping(Column sourceColumn, Column targetColumn) { if ( targetColumn == null ) { if ( targetColumns != null ) { - if (LOG.isEnabled( Level.WARN )) LOG.attemptToMapColumnToNoTargetColumn(sourceColumn.toLoggableString(), getName()); + LOG.debugf( + "Attempt to map column [%s] to no target column after explicit target column(s) named for FK [name=%s]", + sourceColumn.toLoggableString(), + getName() + ); } } else { if ( targetColumns == null ) { - if (!internalColumnAccess().isEmpty()) LOG.valueMappingMismatch(getTable().toLoggableString(), getName(), sourceColumn.toLoggableString()); + if (!internalColumnAccess().isEmpty()) { + LOG.debugf( + "Value mapping mismatch as part of FK [table=%s, name=%s] while adding source column [%s]", + getTable().toLoggableString(), + getName(), + sourceColumn.toLoggableString() + ); + } targetColumns = new ArrayList(); } targetColumns.add( targetColumn ); diff --git a/hibernate-core/src/main/java/org/hibernate/service/jdbc/connections/internal/ConnectionProviderInitiator.java b/hibernate-core/src/main/java/org/hibernate/service/jdbc/connections/internal/ConnectionProviderInitiator.java index 2730776ca2..620fe1f104 100644 --- a/hibernate-core/src/main/java/org/hibernate/service/jdbc/connections/internal/ConnectionProviderInitiator.java +++ b/hibernate-core/src/main/java/org/hibernate/service/jdbc/connections/internal/ConnectionProviderInitiator.java @@ -184,7 +184,7 @@ public class ConnectionProviderInitiator implements BasicServiceInitiator