cleanups, especially to useless uses of JBoss logging
don't use loggers to generate exception messages our convention for exception messages is NOT that they begin with HHH-XXXX it's completely useless to have, like, five of them which do Signed-off-by: Gavin King <gavin@hibernate.org>
This commit is contained in:
parent
83cdeb81b6
commit
f805bcec63
|
@ -24,6 +24,7 @@ import org.hibernate.annotations.JdbcTypeCode;
|
|||
import org.hibernate.annotations.ManyToAny;
|
||||
import org.hibernate.annotations.Target;
|
||||
import org.hibernate.annotations.Type;
|
||||
import org.hibernate.boot.MappingException;
|
||||
import org.hibernate.boot.jaxb.Origin;
|
||||
import org.hibernate.boot.jaxb.SourceType;
|
||||
import org.hibernate.boot.spi.AccessType;
|
||||
|
@ -57,8 +58,6 @@ import jakarta.persistence.Transient;
|
|||
*/
|
||||
public class PropertyContainer {
|
||||
|
||||
private static final CoreMessageLogger LOG = Logger.getMessageLogger( MethodHandles.lookup(), CoreMessageLogger.class, PropertyContainer.class.getName() );
|
||||
|
||||
/**
|
||||
* The class for which this container is created.
|
||||
*/
|
||||
|
@ -201,14 +200,7 @@ public class PropertyContainer {
|
|||
// HHH-10242 detect registration of the same property getter twice - eg boolean isId() + UUID getId()
|
||||
final MethodDetails previous = persistentAttributesFromGetters.get( name );
|
||||
if ( previous != null ) {
|
||||
throw new org.hibernate.boot.MappingException(
|
||||
LOG.ambiguousPropertyMethods(
|
||||
classDetails.getName(),
|
||||
previous.getName(),
|
||||
getterDetails.getName()
|
||||
),
|
||||
new Origin( SourceType.ANNOTATION, classDetails.getName() )
|
||||
);
|
||||
throwAmbiguousPropertyException( classDetails, previous, getterDetails );
|
||||
}
|
||||
|
||||
persistentAttributeMap.put( name, getterDetails );
|
||||
|
@ -228,6 +220,19 @@ public class PropertyContainer {
|
|||
}
|
||||
}
|
||||
|
||||
private static void throwAmbiguousPropertyException(
|
||||
ClassDetails classDetails, MethodDetails previous, MethodDetails getterDetails) {
|
||||
throw new MappingException(
|
||||
String.format(
|
||||
"Ambiguous persistent property methods declared by '%s': '%s' and '%s' (mark one '@Transient')",
|
||||
classDetails.getName(),
|
||||
previous.getName(),
|
||||
getterDetails.getName()
|
||||
),
|
||||
new Origin( SourceType.ANNOTATION, classDetails.getName() )
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Collects members "backing" an attribute based on the Class's "default" access-type
|
||||
*/
|
||||
|
@ -259,22 +264,13 @@ public class PropertyContainer {
|
|||
// HHH-10242 detect registration of the same property getter twice - eg boolean isId() + UUID getId()
|
||||
final MethodDetails previous = persistentAttributesFromGetters.get( name );
|
||||
if ( previous != null && getterDetails != previous ) {
|
||||
throw new org.hibernate.boot.MappingException(
|
||||
LOG.ambiguousPropertyMethods(
|
||||
classDetails.getName(),
|
||||
previous.getName(),
|
||||
getterDetails.getName()
|
||||
),
|
||||
new Origin( SourceType.ANNOTATION, classDetails.getName() )
|
||||
);
|
||||
throwAmbiguousPropertyException( classDetails, previous, getterDetails );
|
||||
}
|
||||
|
||||
if ( persistentAttributeMap.containsKey( name ) ) {
|
||||
continue;
|
||||
if ( !persistentAttributeMap.containsKey( name ) ) {
|
||||
persistentAttributeMap.put( name, getterDetails );
|
||||
persistentAttributesFromGetters.put( name, getterDetails );
|
||||
}
|
||||
|
||||
persistentAttributeMap.put( name, getterDetails );
|
||||
persistentAttributesFromGetters.put( name, getterDetails );
|
||||
}
|
||||
|
||||
// When a user uses the `property` access strategy for the entity owning an embeddable,
|
||||
|
|
|
@ -19,6 +19,7 @@ import java.util.List;
|
|||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.concurrent.ConcurrentMap;
|
||||
|
||||
import org.hibernate.HibernateException;
|
||||
import org.hibernate.boot.registry.classloading.spi.ClassLoaderService;
|
||||
import org.hibernate.boot.registry.classloading.spi.ClassLoadingException;
|
||||
import org.hibernate.internal.CoreLogging;
|
||||
|
@ -208,7 +209,7 @@ public class ClassLoaderServiceImpl implements ClassLoaderService {
|
|||
|
||||
@Override
|
||||
@SuppressWarnings("unchecked")
|
||||
public <T> T generateProxy(InvocationHandler handler, Class... interfaces) {
|
||||
public <T> T generateProxy(InvocationHandler handler, Class<?>... interfaces) {
|
||||
return (T) Proxy.newProxyInstance(
|
||||
getAggregatedClassLoader(),
|
||||
interfaces,
|
||||
|
@ -240,7 +241,7 @@ public class ClassLoaderServiceImpl implements ClassLoaderService {
|
|||
private AggregatedClassLoader getAggregatedClassLoader() {
|
||||
final AggregatedClassLoader aggregated = this.aggregatedClassLoader;
|
||||
if ( aggregated == null ) {
|
||||
throw log.usingStoppedClassLoaderService();
|
||||
throw new HibernateException( "The ClassLoaderService cannot be reused (this instance was stopped already)" );
|
||||
}
|
||||
return aggregated;
|
||||
}
|
||||
|
|
|
@ -101,7 +101,7 @@ public interface ClassLoaderService extends ResourceLocator, ResourceStreamLocat
|
|||
*/
|
||||
<S> Collection<S> loadJavaServices(Class<S> serviceContract);
|
||||
|
||||
<T> T generateProxy(InvocationHandler handler, Class... interfaces);
|
||||
<T> T generateProxy(InvocationHandler handler, Class<?>... interfaces);
|
||||
|
||||
/**
|
||||
* Loading a Package from the ClassLoader.
|
||||
|
|
|
@ -321,7 +321,9 @@ public final class ByteBuddyState {
|
|||
return ClassLoadingStrategy.UsingLookup.of( MethodHandles.privateLookupIn( originalClass, LOOKUP ) );
|
||||
}
|
||||
catch (Throwable e) {
|
||||
throw new HibernateException( LOG.bytecodeEnhancementFailedUnableToGetPrivateLookupFor( originalClass.getName() ), e );
|
||||
throw new HibernateException( "Bytecode enhancement failed for class '" + originalClass.getName()
|
||||
+ "' (it might be due to the Java module system preventing Hibernate ORM from defining an enhanced class in the same package"
|
||||
+ " - in this case, the class should be opened and exported to Hibernate ORM)", e );
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -12,8 +12,6 @@ import org.hibernate.JDBCException;
|
|||
import org.hibernate.exception.internal.SQLStateConversionDelegate;
|
||||
import org.hibernate.exception.internal.StandardSQLExceptionConverter;
|
||||
import org.hibernate.exception.spi.SQLExceptionConverter;
|
||||
import org.hibernate.internal.CoreLogging;
|
||||
import org.hibernate.internal.CoreMessageLogger;
|
||||
|
||||
/**
|
||||
* A helper to centralize conversion of {@link SQLException}s to {@link JDBCException}s.
|
||||
|
@ -23,7 +21,6 @@ import org.hibernate.internal.CoreMessageLogger;
|
|||
* @author Steve Ebersole
|
||||
*/
|
||||
public class BasicSQLExceptionConverter {
|
||||
private static final CoreMessageLogger LOG = CoreLogging.messageLogger( BasicSQLExceptionConverter.class );
|
||||
|
||||
/**
|
||||
* Singleton access
|
||||
|
@ -33,7 +30,6 @@ public class BasicSQLExceptionConverter {
|
|||
/**
|
||||
* Message
|
||||
*/
|
||||
public static final String MSG = LOG.unableToQueryDatabaseMetadata();
|
||||
|
||||
private static final SQLExceptionConverter CONVERTER = new StandardSQLExceptionConverter(
|
||||
new SQLStateConversionDelegate(() -> sqle ->"???" )
|
||||
|
@ -46,7 +42,7 @@ public class BasicSQLExceptionConverter {
|
|||
* @return The converted exception.
|
||||
*/
|
||||
public JDBCException convert(SQLException sqlException) {
|
||||
return CONVERTER.convert( sqlException, MSG, null );
|
||||
return CONVERTER.convert( sqlException, "Unable to query java.sql.DatabaseMetaData", null );
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -18,7 +18,6 @@ import java.util.Iterator;
|
|||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Queue;
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.ConcurrentLinkedQueue;
|
||||
|
||||
|
|
|
@ -8,7 +8,6 @@ package org.hibernate.engine.spi;
|
|||
|
||||
import org.hibernate.AssertionFailure;
|
||||
import org.hibernate.HibernateException;
|
||||
import org.hibernate.collection.spi.AbstractPersistentCollection;
|
||||
import org.hibernate.collection.spi.PersistentCollection;
|
||||
import org.hibernate.internal.CoreLogging;
|
||||
import org.hibernate.internal.CoreMessageLogger;
|
||||
|
@ -226,7 +225,8 @@ public final class CollectionEntry implements Serializable {
|
|||
ignore = false;
|
||||
}
|
||||
else if ( !isProcessed() ) {
|
||||
throw new HibernateException( LOG.collectionNotProcessedByFlush( collection.getRole() ) );
|
||||
throw new HibernateException( "Collection '" + collection.getRole() + "' was not processed by flush"
|
||||
+ " (this is likely due to unsafe use of the session, for example, current use in multiple threads, or updates during entity lifecycle callbacks)");
|
||||
}
|
||||
collection.setSnapshot( loadedKey, role, snapshot );
|
||||
}
|
||||
|
|
|
@ -66,7 +66,7 @@ public class DefaultLockEventListener extends AbstractLockUpgradeEventListener i
|
|||
//TODO: if object was an uninitialized proxy, this is inefficient,
|
||||
// resulting in two SQL selects
|
||||
|
||||
EntityEntry entry = persistenceContext.getEntry(entity);
|
||||
EntityEntry entry = persistenceContext.getEntry( entity );
|
||||
if ( entry == null ) {
|
||||
final EntityPersister persister = source.getEntityPersister( event.getEntityName(), entity );
|
||||
final Object id = persister.getIdentifier( entity, source );
|
||||
|
|
|
@ -6,9 +6,10 @@
|
|||
*/
|
||||
package org.hibernate.id.insert;
|
||||
|
||||
import org.hibernate.HibernateException;
|
||||
import org.hibernate.cfg.AvailableSettings;
|
||||
import org.hibernate.engine.spi.SessionFactoryImplementor;
|
||||
import org.hibernate.generator.EventType;
|
||||
import org.hibernate.internal.CoreLogging;
|
||||
import org.hibernate.jdbc.Expectation;
|
||||
import org.hibernate.persister.entity.EntityPersister;
|
||||
import org.hibernate.sql.model.ast.builder.TableInsertBuilderStandard;
|
||||
|
@ -38,7 +39,9 @@ public class BasicSelectingDelegate extends AbstractSelectingDelegate {
|
|||
final String identitySelectString = persister.getIdentitySelectString();
|
||||
if ( identitySelectString == null
|
||||
&& !dialect().getIdentityColumnSupport().supportsInsertSelectIdentity() ) {
|
||||
throw CoreLogging.messageLogger( BasicSelectingDelegate.class ).nullIdentitySelectString();
|
||||
throw new HibernateException( "Cannot retrieve the generated identity, because '"
|
||||
+ AvailableSettings.USE_GET_GENERATED_KEYS
|
||||
+ "' was disabled and the dialect does not support selecting the last generated identity" );
|
||||
}
|
||||
return identitySelectString;
|
||||
}
|
||||
|
|
|
@ -238,15 +238,11 @@ public interface CoreMessageLogger extends BasicLogger {
|
|||
String incrementParam,
|
||||
int incrementSize,
|
||||
String positiveOrNegative,
|
||||
int defaultIncrementSize
|
||||
);
|
||||
int defaultIncrementSize);
|
||||
|
||||
@LogMessage(level = DEBUG)
|
||||
@Message(value = "HQL: %s, time: %sms, rows: %s", id = 117)
|
||||
void hql(
|
||||
String hql,
|
||||
Long valueOf,
|
||||
Long valueOf2);
|
||||
void hql(String hql, Long valueOf, Long valueOf2);
|
||||
|
||||
@LogMessage(level = WARN)
|
||||
@Message(value = "HSQLDB supports only READ_UNCOMMITTED isolation", id = 118)
|
||||
|
@ -258,15 +254,11 @@ public interface CoreMessageLogger extends BasicLogger {
|
|||
|
||||
@LogMessage(level = ERROR)
|
||||
@Message(value = "IllegalArgumentException in class: %s, getter method of property: %s", id = 122)
|
||||
void illegalPropertyGetterArgument(
|
||||
String name,
|
||||
String propertyName);
|
||||
void illegalPropertyGetterArgument(String name, String propertyName);
|
||||
|
||||
@LogMessage(level = ERROR)
|
||||
@Message(value = "IllegalArgumentException in class: %s, setter method of property: %s", id = 123)
|
||||
void illegalPropertySetterArgument(
|
||||
String name,
|
||||
String propertyName);
|
||||
void illegalPropertySetterArgument(String name, String propertyName);
|
||||
|
||||
@LogMessage(level = DEBUG)
|
||||
@Message(value = "Could not bind JNDI listener", id = 127)
|
||||
|
@ -282,22 +274,11 @@ public interface CoreMessageLogger extends BasicLogger {
|
|||
|
||||
@LogMessage(level = ERROR)
|
||||
@Message(value = "Invalid JNDI name: %s", id = 135)
|
||||
void invalidJndiName(
|
||||
String name,
|
||||
@Cause JndiNameException e);
|
||||
void invalidJndiName(String name, @Cause JndiNameException e);
|
||||
|
||||
@LogMessage(level = INFO)
|
||||
@Message(value = "java.sql.Types mapped the same code [%s] multiple times; was [%s]; now [%s]", id = 141)
|
||||
void JavaSqlTypesMappedSameCodeMultipleTimes(
|
||||
int code,
|
||||
String old,
|
||||
String name);
|
||||
|
||||
@Message(value = "Bytecode enhancement failed: %s", id = 142)
|
||||
String bytecodeEnhancementFailed(String entityName);
|
||||
|
||||
@Message(value = "Bytecode enhancement failed because no public, protected or package-private default constructor was found for entity: %s. Private constructors don't work with runtime proxies", id = 143)
|
||||
String bytecodeEnhancementFailedBecauseOfDefaultConstructor(String entityName);
|
||||
void JavaSqlTypesMappedSameCodeMultipleTimes(int code, String old, String name);
|
||||
|
||||
@LogMessage(level = DEBUG)
|
||||
@Message(value = "Lazy property fetching available for: %s", id = 157)
|
||||
|
@ -395,9 +376,7 @@ public interface CoreMessageLogger extends BasicLogger {
|
|||
@LogMessage(level = WARN)
|
||||
@Message(value = "Recognized obsolete hibernate namespace %s. Use namespace %s instead. Refer to Hibernate 3.6 Migration Guide",
|
||||
id = 223)
|
||||
void recognizedObsoleteHibernateNamespace(
|
||||
String oldHibernateNamespace,
|
||||
String hibernateNamespace);
|
||||
void recognizedObsoleteHibernateNamespace(String oldHibernateNamespace, String hibernateNamespace);
|
||||
|
||||
@LogMessage(level = INFO)
|
||||
@Message(value = "Running hbm2ddl schema export", id = 227)
|
||||
|
@ -439,9 +418,7 @@ public interface CoreMessageLogger extends BasicLogger {
|
|||
|
||||
@LogMessage(level = WARN)
|
||||
@Message(value = "SQL Error: %s, SQLState: %s", id = 247)
|
||||
void sqlWarning(
|
||||
int errorCode,
|
||||
String sqlState);
|
||||
void sqlWarning(int errorCode, String sqlState);
|
||||
|
||||
@LogMessage(level = INFO)
|
||||
@Message(value = "Start time: %s", id = 251)
|
||||
|
@ -491,9 +468,7 @@ public interface CoreMessageLogger extends BasicLogger {
|
|||
|
||||
@LogMessage(level = WARN)
|
||||
@Message(value = "Unable to apply constraints on DDL for %s", id = 274)
|
||||
void unableToApplyConstraints(
|
||||
String className,
|
||||
@Cause Exception e);
|
||||
void unableToApplyConstraints(String className, @Cause Exception e);
|
||||
|
||||
@LogMessage(level = WARN)
|
||||
@Message(value = "Could not bind factory to JNDI", id = 277)
|
||||
|
@ -525,9 +500,7 @@ public interface CoreMessageLogger extends BasicLogger {
|
|||
|
||||
@LogMessage(level = ERROR)
|
||||
@Message(value = "Unable to construct current session context [%s]", id = 302)
|
||||
void unableToConstructCurrentSessionContext(
|
||||
String impl,
|
||||
@Cause Throwable e);
|
||||
void unableToConstructCurrentSessionContext(String impl, @Cause Throwable e);
|
||||
|
||||
@LogMessage(level = WARN)
|
||||
@Message(value = "Could not copy system properties, system properties will be ignored", id = 304)
|
||||
|
@ -535,9 +508,7 @@ public interface CoreMessageLogger extends BasicLogger {
|
|||
|
||||
@LogMessage(level = WARN)
|
||||
@Message(value = "Could not create proxy factory for:%s", id = 305)
|
||||
void unableToCreateProxyFactory(
|
||||
String entityName,
|
||||
@Cause HibernateException e);
|
||||
void unableToCreateProxyFactory(String entityName, @Cause HibernateException e);
|
||||
|
||||
@LogMessage(level = ERROR)
|
||||
@Message(value = "Error creating schema ", id = 306)
|
||||
|
@ -545,9 +516,7 @@ public interface CoreMessageLogger extends BasicLogger {
|
|||
|
||||
@LogMessage(level = WARN)
|
||||
@Message(value = "Could not deserialize cache file [%s]: %s", id = 307)
|
||||
void unableToDeserializeCache(
|
||||
String path,
|
||||
SerializationException error);
|
||||
void unableToDeserializeCache(String path, SerializationException error);
|
||||
|
||||
/**
|
||||
* @deprecated Use {@link org.hibernate.engine.jdbc.batch.JdbcBatchLogging#unableToExecuteBatch} instead
|
||||
|
@ -581,9 +550,6 @@ public interface CoreMessageLogger extends BasicLogger {
|
|||
@Message(value = "Problem loading properties from hibernate.properties", id = 329)
|
||||
void unableToLoadProperties();
|
||||
|
||||
@Message(value = "Unable to locate config file: %s", id = 330)
|
||||
String unableToLocateConfigFile(String path);
|
||||
|
||||
@LogMessage(level = WARN)
|
||||
@Message(value = "Unable to locate requested UUID generation strategy class: %s", id = 334)
|
||||
void unableToLocateUuidGenerationStrategy(String strategyClassName);
|
||||
|
@ -608,9 +574,6 @@ public interface CoreMessageLogger extends BasicLogger {
|
|||
@Message(value = "Could not obtain connection to query metadata", id = 342)
|
||||
void unableToObtainConnectionToQueryMetadata(@Cause Exception e);
|
||||
|
||||
@Message(value = "Unable to query java.sql.DatabaseMetaData", id = 347)
|
||||
String unableToQueryDatabaseMetadata();
|
||||
|
||||
@LogMessage(level = ERROR)
|
||||
@Message(value = "Could not read or init a hi value", id = 351)
|
||||
void unableToReadOrInitHiValue(@Cause SQLException e);
|
||||
|
@ -699,10 +662,7 @@ public interface CoreMessageLogger extends BasicLogger {
|
|||
|
||||
@LogMessage(level = INFO)
|
||||
@Message(value = "Explicit segment value for id generator [%s.%s] suggested; using default [%s]", id = 398)
|
||||
void usingDefaultIdGeneratorSegmentValue(
|
||||
String tableName,
|
||||
String segmentColumnName,
|
||||
String defaultToUse);
|
||||
void usingDefaultIdGeneratorSegmentValue(String tableName, String segmentColumnName, String defaultToUse);
|
||||
|
||||
/**
|
||||
* @deprecated Use {@link org.hibernate.dialect.DialectLogging#usingDialect} instead
|
||||
|
@ -719,9 +679,7 @@ public interface CoreMessageLogger extends BasicLogger {
|
|||
@LogMessage(level = WARN)
|
||||
@Message(value = "Using %s which does not generate IETF RFC 4122 compliant UUID values; consider using %s instead",
|
||||
id = 409)
|
||||
void usingUuidHexGenerator(
|
||||
String name,
|
||||
String name2);
|
||||
void usingUuidHexGenerator(String name, String name2);
|
||||
|
||||
@LogMessage(level = INFO)
|
||||
@Message(value = "Hibernate ORM core version %s", id = 412)
|
||||
|
@ -883,9 +841,6 @@ public interface CoreMessageLogger extends BasicLogger {
|
|||
@Message(value = "Unable to interpret type [%s] as an AttributeConverter due to an exception: %s", id = 468)
|
||||
void logBadHbmAttributeConverterType(String type, String exceptionMessage);
|
||||
|
||||
@Message(value = "The ClassLoaderService can not be reused. This instance was stopped already.", id = 469)
|
||||
HibernateException usingStoppedClassLoaderService();
|
||||
|
||||
@LogMessage(level = WARN)
|
||||
@Message(value = "An unexpected session is defined for a collection, but the collection is not connected to that session. A persistent collection may only be associated with one session at a time. Overwriting session. %s", id = 470)
|
||||
void logUnexpectedSessionInCollectionNotConnected(String msg);
|
||||
|
@ -898,12 +853,6 @@ public interface CoreMessageLogger extends BasicLogger {
|
|||
@Message(value = "Omitting cached file [%s] as the mapping file is newer", id = 473)
|
||||
void cachedFileObsolete(File cachedFile);
|
||||
|
||||
@Message(
|
||||
value = "Ambiguous persistent property methods detected on %s; mark one as @Transient: [%s] and [%s]",
|
||||
id = 474
|
||||
)
|
||||
String ambiguousPropertyMethods(String entityName, String oneMethodSig, String secondMethodSig);
|
||||
|
||||
@LogMessage(level = INFO)
|
||||
@Message(value = "Cannot locate column information using identifier [%s]; ignoring index [%s]", id = 475 )
|
||||
void logCannotLocateIndexColumnInformation(String columnIdentifierText, String indexIdentifierText);
|
||||
|
@ -920,13 +869,6 @@ public interface CoreMessageLogger extends BasicLogger {
|
|||
@Message(value = "Unsuccessful: %s", id = 478)
|
||||
void unsuccessfulSchemaManagementCommand(String command);
|
||||
|
||||
@Message(
|
||||
value = "Collection [%s] was not processed by flush()."
|
||||
+ " This is likely due to unsafe use of the session (e.g. used in multiple threads concurrently, updates during entity lifecycle hooks).",
|
||||
id = 479
|
||||
)
|
||||
String collectionNotProcessedByFlush(@Nullable String role);
|
||||
|
||||
@LogMessage(level = WARN)
|
||||
@Message(value = "A ManagedEntity was associated with a stale PersistenceContext. A ManagedEntity may only be associated with one PersistenceContext at a time; %s", id = 480)
|
||||
void stalePersistenceContextInEntityEntry(String msg);
|
||||
|
@ -940,10 +882,6 @@ public interface CoreMessageLogger extends BasicLogger {
|
|||
id = 487)
|
||||
void immutableEntityUpdateQuery(String sourceQuery, String querySpaces);
|
||||
|
||||
@Message(value = "Bytecode enhancement failed for class: %1$s. It might be due to the Java module system preventing Hibernate ORM from defining an enhanced class "
|
||||
+ "in the same package as class %1$s. In this case, the class should be opened and exported to Hibernate ORM.", id = 488)
|
||||
String bytecodeEnhancementFailedUnableToGetPrivateLookupFor(String className);
|
||||
|
||||
@LogMessage(level = INFO)
|
||||
@Message(value = "No JTA platform available (set 'hibernate.transaction.jta.platform' to enable JTA platform integration)", id = 489)
|
||||
void noJtaPlatform();
|
||||
|
@ -1022,10 +960,6 @@ public interface CoreMessageLogger extends BasicLogger {
|
|||
id = 513)
|
||||
void unableToGenerateReflectionOptimizer(String className, String cause);
|
||||
|
||||
@Message(value = "Can't retrieve the generated identity value, because the dialect does not support selecting the last generated identity and 'hibernate.jdbc.use_get_generated_keys' was disabled",
|
||||
id = 515)
|
||||
HibernateException nullIdentitySelectString();
|
||||
|
||||
@LogMessage(level = WARN)
|
||||
@Message(value = "Failed to discover types for enhancement from class: %s",
|
||||
id = 516)
|
||||
|
|
|
@ -19,8 +19,6 @@ import org.jboss.logging.annotations.Message;
|
|||
import org.jboss.logging.annotations.MessageLogger;
|
||||
import org.jboss.logging.annotations.ValidIdRange;
|
||||
|
||||
import jakarta.persistence.Temporal;
|
||||
|
||||
import static org.jboss.logging.Logger.Level.WARN;
|
||||
|
||||
/**
|
||||
|
@ -55,22 +53,6 @@ public interface DeprecationLogger extends BasicLogger {
|
|||
)
|
||||
void logDeprecationOfNonNamedIdAttribute(String entityName);
|
||||
|
||||
// /**
|
||||
// * Log a warning about an attempt to specify no-longer-supported NamingStrategy
|
||||
// *
|
||||
// * @param setting - The old setting that indicates the NamingStrategy to use
|
||||
// * @param implicitInstead - The new setting that indicates the ImplicitNamingStrategy to use
|
||||
// * @param physicalInstead - The new setting that indicates the PhysicalNamingStrategy to use
|
||||
// */
|
||||
// @LogMessage(level = WARN)
|
||||
// @Message(
|
||||
// value = "Attempted to specify unsupported NamingStrategy via setting [%s]; NamingStrategy " +
|
||||
// "has been removed in favor of the split ImplicitNamingStrategy and " +
|
||||
// "PhysicalNamingStrategy; use [%s] or [%s], respectively, instead.",
|
||||
// id = 90000006
|
||||
// )
|
||||
// void logDeprecatedNamingStrategySetting(String setting, String implicitInstead, String physicalInstead);
|
||||
|
||||
/**
|
||||
* Log a warning about an attempt to specify unsupported NamingStrategy
|
||||
*/
|
||||
|
@ -115,14 +97,6 @@ public interface DeprecationLogger extends BasicLogger {
|
|||
)
|
||||
void deprecatedManyToManyFetch();
|
||||
|
||||
// @LogMessage(level = WARN)
|
||||
// @Message(
|
||||
// value = "org.hibernate.hql.spi.TemporaryTableBulkIdStrategy (temporary) has been deprecated in favor of the" +
|
||||
// " more specific org.hibernate.hql.spi.id.local.LocalTemporaryTableBulkIdStrategy (local_temporary).",
|
||||
// id = 90000011
|
||||
// )
|
||||
// void logDeprecationOfTemporaryTableBulkIdStrategy();
|
||||
|
||||
@LogMessage(level = WARN)
|
||||
@Message(value = "Recognized obsolete hibernate namespace %s. Use namespace %s instead. Support for obsolete DTD/XSD namespaces may be removed at any time.",
|
||||
id = 90000012)
|
||||
|
@ -130,48 +104,6 @@ public interface DeprecationLogger extends BasicLogger {
|
|||
String oldHibernateNamespace,
|
||||
String hibernateNamespace);
|
||||
|
||||
@LogMessage(level = WARN)
|
||||
@Message(
|
||||
id = 90000013,
|
||||
value = "Named ConnectionProvider [%s] has been deprecated in favor of %s; that provider will be used instead. Update your settings"
|
||||
)
|
||||
void connectionProviderClassDeprecated(
|
||||
String providerClassName,
|
||||
String actualProviderClassName);
|
||||
|
||||
@LogMessage(level = WARN)
|
||||
@Message(
|
||||
id = 90000014,
|
||||
value = "Found use of deprecated [%s] sequence-based id generator; " +
|
||||
"use org.hibernate.id.enhanced.SequenceStyleGenerator instead. " +
|
||||
"See Hibernate Domain Model Mapping Guide for details."
|
||||
)
|
||||
void deprecatedSequenceGenerator(String generatorImpl);
|
||||
|
||||
@LogMessage(level = WARN)
|
||||
@Message(
|
||||
id = 90000015,
|
||||
value = "Found use of deprecated [%s] table-based id generator; " +
|
||||
"use org.hibernate.id.enhanced.TableGenerator instead. " +
|
||||
"See Hibernate Domain Model Mapping Guide for details."
|
||||
)
|
||||
void deprecatedTableGenerator(String generatorImpl);
|
||||
|
||||
// @LogMessage(level = WARN)
|
||||
// @Message(
|
||||
// id = 90000016,
|
||||
// value = "Found use of deprecated 'collection property' syntax in HQL/JPQL query [%2$s.%1$s]; " +
|
||||
// "use collection function syntax instead [%1$s(%2$s)]."
|
||||
// )
|
||||
// void logDeprecationOfCollectionPropertiesInHql(String collectionPropertyName, String alias);
|
||||
|
||||
// @LogMessage(level = WARN)
|
||||
// @Message(
|
||||
// id = 90000017,
|
||||
// value = "Found use of deprecated entity-type selector syntax in HQL/JPQL query ['%1$s.class']; use TYPE operator instead : type(%1$s)"
|
||||
// )
|
||||
// void logDeprecationOfClassEntityTypeSelector(String path);
|
||||
|
||||
@LogMessage(level = WARN)
|
||||
@Message(
|
||||
id = 90000018,
|
||||
|
@ -179,22 +111,6 @@ public interface DeprecationLogger extends BasicLogger {
|
|||
)
|
||||
void logDeprecatedTransactionFactorySetting(String legacySettingName, String updatedSettingName);
|
||||
|
||||
// @LogMessage(level = WARN)
|
||||
// @Message(
|
||||
// id = 90000019,
|
||||
// value = "You are using the deprecated legacy bytecode enhancement feature which has been superseded by a vastly improved bytecode enhancer."
|
||||
// )
|
||||
// void logDeprecatedBytecodeEnhancement();
|
||||
|
||||
// @LogMessage(level = WARN)
|
||||
// @Message(
|
||||
// id = 90000020,
|
||||
// value = "You are using the deprecated legacy bytecode enhancement Ant-task. This task is left in place for a short-time to " +
|
||||
// "aid migrations to 5.1 and the new (vastly improved) bytecode enhancement support. This task (%s) now delegates to the" +
|
||||
// "new Ant-task (%s) leveraging that new bytecode enhancement. You should update your build to use the new task explicitly."
|
||||
// )
|
||||
// void logDeprecatedInstrumentTask(Class taskClass, Class newTaskClass);
|
||||
|
||||
@LogMessage(level = WARN)
|
||||
@Message(
|
||||
id = 90000021,
|
||||
|
@ -202,30 +118,6 @@ public interface DeprecationLogger extends BasicLogger {
|
|||
)
|
||||
void deprecatedSetting(String oldSettingName, String newSettingName);
|
||||
|
||||
// @LogMessage(level = WARN)
|
||||
// @Message(
|
||||
// id = 90000022,
|
||||
// value = "Hibernate's legacy org.hibernate.Criteria API is deprecated; use the JPA jakarta.persistence.criteria.CriteriaQuery instead"
|
||||
// )
|
||||
// void deprecatedLegacyCriteria();
|
||||
|
||||
// @LogMessage(level = WARN)
|
||||
// @Message(
|
||||
// id = 90000024,
|
||||
// value = "Application requested zero be used as the base for JDBC-style parameters found in native-queries; " +
|
||||
// "this is a *temporary* backwards-compatibility setting to help applications using versions prior to " +
|
||||
// "5.3 in upgrading. It will be removed in a later version."
|
||||
// )
|
||||
// void logUseOfDeprecatedZeroBasedJdbcStyleParams();
|
||||
|
||||
// @LogMessage(level = WARN)
|
||||
// @Message(
|
||||
// id = 90000025,
|
||||
// value = "Encountered multiple component mappings for the same java class [%s] with different property mappings. " +
|
||||
// "This is deprecated and will be removed in a future version. Every property mapping combination should have its own java class"
|
||||
// )
|
||||
// void deprecatedComponentMapping(String name);
|
||||
|
||||
@LogMessage(level = WARN)
|
||||
@Message(value = "%s does not need to be specified explicitly using 'hibernate.dialect' "
|
||||
+ "(remove the property setting and it will be selected by default)",
|
||||
|
@ -242,17 +134,6 @@ public interface DeprecationLogger extends BasicLogger {
|
|||
id = 90000026)
|
||||
void deprecatedDialect(String dialect, String replacement);
|
||||
|
||||
/**
|
||||
* Different from {@link #deprecatedSetting} in that sometimes there is no
|
||||
* direct alternative
|
||||
*/
|
||||
@LogMessage(level = WARN)
|
||||
@Message(
|
||||
id = 90000027,
|
||||
value = "Encountered deprecated setting [%s]; instead %s"
|
||||
)
|
||||
void deprecatedSetting2(String settingName, String alternative);
|
||||
|
||||
/**
|
||||
* Different from {@link #deprecatedSetting} in that sometimes there is no
|
||||
* direct alternative
|
||||
|
|
|
@ -13,8 +13,6 @@ import java.net.URL;
|
|||
|
||||
import org.hibernate.HibernateException;
|
||||
import org.hibernate.cfg.Environment;
|
||||
import org.hibernate.internal.CoreLogging;
|
||||
import org.hibernate.internal.CoreMessageLogger;
|
||||
|
||||
/**
|
||||
* A simple class to centralize logic needed to locate config files on the system.
|
||||
|
@ -25,7 +23,6 @@ import org.hibernate.internal.CoreMessageLogger;
|
|||
*/
|
||||
@Deprecated
|
||||
public final class ConfigHelper {
|
||||
private static final CoreMessageLogger LOG = CoreLogging.messageLogger( ConfigHelper.class );
|
||||
|
||||
/**
|
||||
* Try to locate a local URL representing the incoming path. The first attempt
|
||||
|
@ -60,7 +57,7 @@ public final class ConfigHelper {
|
|||
|
||||
// First, try to locate this resource through the current
|
||||
// context classloader.
|
||||
ClassLoader contextClassLoader = Thread.currentThread().getContextClassLoader();
|
||||
final ClassLoader contextClassLoader = Thread.currentThread().getContextClassLoader();
|
||||
if ( contextClassLoader != null ) {
|
||||
url = contextClassLoader.getResource( path );
|
||||
}
|
||||
|
@ -93,14 +90,10 @@ public final class ConfigHelper {
|
|||
* @throws HibernateException Unable to open stream to that resource.
|
||||
*/
|
||||
public static InputStream getConfigStream(final String path) throws HibernateException {
|
||||
final URL url = ConfigHelper.locateConfig( path );
|
||||
|
||||
final URL url = locateConfig( path );
|
||||
if ( url == null ) {
|
||||
String msg = LOG.unableToLocateConfigFile( path );
|
||||
LOG.error( msg );
|
||||
throw new HibernateException( msg );
|
||||
throw new HibernateException( "Unable to locate config file: " + path );
|
||||
}
|
||||
|
||||
try {
|
||||
return url.openStream();
|
||||
}
|
||||
|
@ -113,12 +106,12 @@ public final class ConfigHelper {
|
|||
}
|
||||
|
||||
public static InputStream getResourceAsStream(String resource) {
|
||||
String stripped = resource.startsWith( "/" )
|
||||
final String stripped = resource.startsWith( "/" )
|
||||
? resource.substring( 1 )
|
||||
: resource;
|
||||
|
||||
InputStream stream = null;
|
||||
ClassLoader classLoader = Thread.currentThread().getContextClassLoader();
|
||||
final ClassLoader classLoader = Thread.currentThread().getContextClassLoader();
|
||||
if ( classLoader != null ) {
|
||||
stream = classLoader.getResourceAsStream( stripped );
|
||||
}
|
||||
|
@ -137,7 +130,7 @@ public final class ConfigHelper {
|
|||
|
||||
public static InputStream getUserResourceAsStream(String resource) {
|
||||
boolean hasLeadingSlash = resource.startsWith( "/" );
|
||||
String stripped = hasLeadingSlash ? resource.substring( 1 ) : resource;
|
||||
final String stripped = hasLeadingSlash ? resource.substring( 1 ) : resource;
|
||||
|
||||
InputStream stream = null;
|
||||
|
||||
|
|
|
@ -54,11 +54,11 @@ public final class LockModeConverter {
|
|||
/**
|
||||
* Convert from JPA defined {@link LockModeType} to Hibernate-specific {@link LockMode}.
|
||||
*
|
||||
* @param lockMode The JPA {@link LockModeType}
|
||||
* @param lockModeType The JPA {@link LockModeType}
|
||||
* @return The Hibernate {@link LockMode}.
|
||||
*/
|
||||
public static LockMode convertToLockMode(LockModeType lockMode) {
|
||||
switch ( lockMode ) {
|
||||
public static LockMode convertToLockMode(LockModeType lockModeType) {
|
||||
switch ( lockModeType ) {
|
||||
case NONE:
|
||||
return LockMode.NONE;
|
||||
case READ:
|
||||
|
@ -74,7 +74,7 @@ public final class LockModeConverter {
|
|||
case PESSIMISTIC_FORCE_INCREMENT:
|
||||
return LockMode.PESSIMISTIC_FORCE_INCREMENT;
|
||||
default:
|
||||
throw new AssertionFailure( "Unknown LockModeType: " + lockMode );
|
||||
throw new AssertionFailure( "Unknown LockModeType: " + lockModeType );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -13,20 +13,16 @@ import java.util.Set;
|
|||
import org.hibernate.HibernateException;
|
||||
import org.hibernate.engine.spi.PrimeAmongSecondarySupertypes;
|
||||
import org.hibernate.engine.spi.SharedSessionContractImplementor;
|
||||
import org.hibernate.internal.CoreMessageLogger;
|
||||
import org.hibernate.internal.util.ReflectHelper;
|
||||
import org.hibernate.internal.util.collections.ArrayHelper;
|
||||
import org.hibernate.proxy.HibernateProxy;
|
||||
import org.hibernate.proxy.ProxyConfiguration;
|
||||
import org.hibernate.proxy.ProxyFactory;
|
||||
import org.hibernate.type.CompositeType;
|
||||
|
||||
import static org.hibernate.internal.CoreLogging.messageLogger;
|
||||
import static org.hibernate.internal.util.collections.ArrayHelper.EMPTY_CLASS_ARRAY;
|
||||
|
||||
public class ByteBuddyProxyFactory implements ProxyFactory, Serializable {
|
||||
|
||||
private static final CoreMessageLogger LOG = messageLogger( ByteBuddyProxyFactory.class );
|
||||
|
||||
private final ByteBuddyProxyHelper byteBuddyProxyHelper;
|
||||
|
||||
private Class<?> persistentClass;
|
||||
|
@ -63,11 +59,7 @@ public class ByteBuddyProxyFactory implements ProxyFactory, Serializable {
|
|||
}
|
||||
|
||||
private Class<?>[] toArray(Set<Class<?>> interfaces) {
|
||||
if ( interfaces == null ) {
|
||||
return ArrayHelper.EMPTY_CLASS_ARRAY;
|
||||
}
|
||||
|
||||
return interfaces.toArray( new Class[interfaces.size()] );
|
||||
return interfaces == null ? EMPTY_CLASS_ARRAY : interfaces.toArray(EMPTY_CLASS_ARRAY);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -115,14 +107,12 @@ public class ByteBuddyProxyFactory implements ProxyFactory, Serializable {
|
|||
return (PrimeAmongSecondarySupertypes) proxyClass.getConstructor().newInstance();
|
||||
}
|
||||
catch (NoSuchMethodException e) {
|
||||
String logMessage = LOG.bytecodeEnhancementFailedBecauseOfDefaultConstructor( entityName );
|
||||
LOG.error( logMessage, e );
|
||||
throw new HibernateException( logMessage, e );
|
||||
throw new HibernateException(
|
||||
"Bytecode enhancement failed because no public, protected or package-private default constructor was found for entity '"
|
||||
+ entityName + "' (private constructors don't work with runtime proxies)", e );
|
||||
}
|
||||
catch (Throwable t) {
|
||||
String logMessage = LOG.bytecodeEnhancementFailed( entityName );
|
||||
LOG.error( logMessage, t );
|
||||
throw new HibernateException( logMessage, t );
|
||||
throw new HibernateException( "Bytecode enhancement failed for entity '" + entityName + "'", t );
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -6,8 +6,6 @@
|
|||
*/
|
||||
package org.hibernate.proxy.pojo.bytebuddy;
|
||||
|
||||
import static org.hibernate.internal.CoreLogging.messageLogger;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.lang.reflect.Method;
|
||||
import java.util.Collection;
|
||||
|
@ -20,7 +18,6 @@ import java.util.function.Function;
|
|||
import org.hibernate.HibernateException;
|
||||
import org.hibernate.bytecode.internal.bytebuddy.ByteBuddyState;
|
||||
import org.hibernate.engine.spi.PrimeAmongSecondarySupertypes;
|
||||
import org.hibernate.internal.CoreMessageLogger;
|
||||
import org.hibernate.internal.util.ReflectHelper;
|
||||
import org.hibernate.proxy.HibernateProxy;
|
||||
import org.hibernate.proxy.ProxyConfiguration;
|
||||
|
@ -39,7 +36,6 @@ import net.bytebuddy.pool.TypePool;
|
|||
|
||||
public class ByteBuddyProxyHelper implements Serializable {
|
||||
|
||||
private static final CoreMessageLogger LOG = messageLogger( ByteBuddyProxyHelper.class );
|
||||
private static final String PROXY_NAMING_SUFFIX = "HibernateProxy";
|
||||
private static final TypeDescription OBJECT = TypeDescription.ForLoadedType.of(Object.class);
|
||||
|
||||
|
@ -130,13 +126,11 @@ public class ByteBuddyProxyHelper implements Serializable {
|
|||
return hibernateProxy;
|
||||
}
|
||||
catch (Throwable t) {
|
||||
final String message = LOG.bytecodeEnhancementFailed( serializableProxy.getEntityName() );
|
||||
LOG.error( message, t );
|
||||
throw new HibernateException( message, t );
|
||||
throw new HibernateException( "Bytecode enhancement failed for entity '"
|
||||
+ serializableProxy.getEntityName() + "'", t );
|
||||
}
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
private static Method resolveIdGetterMethod(SerializableProxy serializableProxy) {
|
||||
if ( serializableProxy.getIdentifierGetterMethodName() == null ) {
|
||||
return null;
|
||||
|
@ -159,7 +153,6 @@ public class ByteBuddyProxyHelper implements Serializable {
|
|||
}
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
private static Method resolveIdSetterMethod(SerializableProxy serializableProxy) {
|
||||
if ( serializableProxy.getIdentifierSetterMethodName() == null ) {
|
||||
return null;
|
||||
|
|
|
@ -6,22 +6,16 @@
|
|||
*/
|
||||
package org.hibernate.query.hql;
|
||||
|
||||
import org.hibernate.HibernateException;
|
||||
import org.hibernate.internal.log.SubSystemLogging;
|
||||
import org.hibernate.query.QueryLogging;
|
||||
|
||||
import org.jboss.logging.BasicLogger;
|
||||
import org.jboss.logging.Logger;
|
||||
import org.jboss.logging.annotations.Cause;
|
||||
import org.jboss.logging.annotations.LogMessage;
|
||||
import org.jboss.logging.annotations.Message;
|
||||
import org.jboss.logging.annotations.MessageLogger;
|
||||
import org.jboss.logging.annotations.ValidIdRange;
|
||||
|
||||
import java.lang.invoke.MethodHandles;
|
||||
|
||||
import static org.jboss.logging.Logger.Level.ERROR;
|
||||
|
||||
/**
|
||||
* @author Steve Ebersole
|
||||
*/
|
||||
|
@ -47,8 +41,4 @@ public interface HqlLogging extends BasicLogger {
|
|||
static <T> T subLogger(String subName, Class<T> loggerJavaType) {
|
||||
return Logger.getMessageLogger( MethodHandles.lookup(), loggerJavaType, subLoggerName( subName ) );
|
||||
}
|
||||
|
||||
@LogMessage(level = ERROR)
|
||||
@Message(value = "Error in named query: %s", id = 90003501)
|
||||
void namedQueryError(String queryName, @Cause HibernateException e);
|
||||
}
|
||||
|
|
|
@ -103,10 +103,10 @@ public class IdentityIdEntityTest {
|
|||
IdentityEntity ie = new IdentityEntity();
|
||||
ie.setTimestamp( new Date() );
|
||||
session.persist( ie );
|
||||
fail( "A HibernateException with message id HHH000515 should have been thrown" );
|
||||
fail( "A HibernateException should have been thrown" );
|
||||
}
|
||||
catch (Exception e) {
|
||||
assertTrue( e.getMessage().startsWith( "HHH000515" ) );
|
||||
assertTrue( e.getMessage().contains( AvailableSettings.USE_GET_GENERATED_KEYS ) );
|
||||
}
|
||||
}
|
||||
);
|
||||
|
|
|
@ -73,7 +73,6 @@ public class PrivateConstructorTest {
|
|||
|
||||
scope.inTransaction(
|
||||
entityManager -> {
|
||||
Triggerable triggerable = logInspection.watchForLogMessages( "HHH000143:" );
|
||||
Child childReference = entityManager.getReference( Child.class, child.getId() );
|
||||
try {
|
||||
assertEquals( child.getParent().getName(), childReference.getParent().getName() );
|
||||
|
@ -84,7 +83,6 @@ public class PrivateConstructorTest {
|
|||
"Bytecode enhancement failed because no public, protected or package-private default constructor was found for entity"
|
||||
) );
|
||||
}
|
||||
assertTrue( triggerable.wasTriggered() );
|
||||
}
|
||||
);
|
||||
}
|
||||
|
|
|
@ -76,7 +76,7 @@ public class GetAndIsVariantGetterTest {
|
|||
fail( "Expecting a failure" );
|
||||
}
|
||||
catch (MappingException e) {
|
||||
assertThat( e.getMessage(), startsWith( "HHH000474: Ambiguous persistent property methods detected on" ) );
|
||||
assertThat( e.getMessage(), startsWith( "Ambiguous persistent property methods" ) );
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -89,8 +89,8 @@ public class ClassLoaderServiceImplTest {
|
|||
Assert.fail("Should have thrown an HibernateException -- the ClassLoaderService instance was closed.");
|
||||
}
|
||||
catch (HibernateException e) {
|
||||
String message = e.getMessage();
|
||||
Assert.assertEquals( "HHH000469: The ClassLoaderService can not be reused. This instance was stopped already.", message);
|
||||
Assert.assertEquals( "The ClassLoaderService cannot be reused (this instance was stopped already)",
|
||||
e.getMessage() );
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue