diff --git a/hibernate-core/src/main/java/org/hibernate/boot/model/internal/AbstractPropertyHolder.java b/hibernate-core/src/main/java/org/hibernate/boot/model/internal/AbstractPropertyHolder.java index 1b1875ae34..c49bfcaa50 100644 --- a/hibernate-core/src/main/java/org/hibernate/boot/model/internal/AbstractPropertyHolder.java +++ b/hibernate-core/src/main/java/org/hibernate/boot/model/internal/AbstractPropertyHolder.java @@ -8,7 +8,6 @@ package org.hibernate.boot.model.internal; import java.lang.annotation.Annotation; import java.util.ArrayList; -import java.util.Arrays; import java.util.HashMap; import java.util.List; import java.util.Map; @@ -28,7 +27,6 @@ import org.hibernate.boot.model.naming.ImplicitBasicColumnNameSource; import org.hibernate.boot.model.source.spi.AttributePath; import org.hibernate.boot.spi.MetadataBuildingContext; import org.hibernate.internal.CoreLogging; -import org.hibernate.internal.util.StringHelper; import org.hibernate.usertype.internal.AbstractTimeZoneStorageCompositeUserType; import org.hibernate.usertype.internal.OffsetTimeCompositeUserType; @@ -48,6 +46,7 @@ import jakarta.persistence.MappedSuperclass; import static org.hibernate.boot.model.internal.TimeZoneStorageHelper.isOffsetTimeClass; import static org.hibernate.boot.model.internal.TimeZoneStorageHelper.useColumnForTimeZoneStorage; +import static org.hibernate.internal.util.StringHelper.qualify; /** * @author Emmanuel Bernard @@ -191,27 +190,27 @@ public abstract class AbstractPropertyHolder implements PropertyHolder { } else { this.currentPropertyColumnOverride = buildColumnOverride( property, getPath(), context ); - if ( this.currentPropertyColumnOverride.size() == 0 ) { + if ( this.currentPropertyColumnOverride.isEmpty() ) { this.currentPropertyColumnOverride = null; } this.currentPropertyColumnTransformerOverride = buildColumnTransformerOverride( property ); - if ( this.currentPropertyColumnTransformerOverride.size() == 0 ) { + if ( this.currentPropertyColumnTransformerOverride.isEmpty() ) { this.currentPropertyColumnTransformerOverride = null; } this.currentPropertyJoinColumnOverride = buildJoinColumnOverride( property, getPath() ); - if ( this.currentPropertyJoinColumnOverride.size() == 0 ) { + if ( this.currentPropertyJoinColumnOverride.isEmpty() ) { this.currentPropertyJoinColumnOverride = null; } this.currentPropertyJoinTableOverride = buildJoinTableOverride( property, getPath() ); - if ( this.currentPropertyJoinTableOverride.size() == 0 ) { + if ( this.currentPropertyJoinTableOverride.isEmpty() ) { this.currentPropertyJoinTableOverride = null; } this.currentPropertyForeignKeyOverride = buildForeignKeyOverride( property, getPath() ); - if ( this.currentPropertyForeignKeyOverride.size() == 0 ) { + if ( this.currentPropertyForeignKeyOverride.isEmpty() ) { this.currentPropertyForeignKeyOverride = null; } } @@ -226,43 +225,9 @@ public abstract class AbstractPropertyHolder implements PropertyHolder { @Override public Column[] getOverriddenColumn(String propertyName) { Column[] result = getExactOverriddenColumn( propertyName ); - if (result == null) { - //the commented code can be useful if people use the new prefixes on old mappings and vice versa - // if we enable them: - // WARNING: this can conflict with user's expectations if: - // - the property uses some restricted values - // - the user has overridden the column - // also change getOverriddenJoinColumn and getOverriddenJoinTable as well - -// if ( propertyName.contains( ".key." ) ) { -// //support for legacy @AttributeOverride declarations -// //TODO cache the underlying regexp -// result = getExactOverriddenColumn( propertyName.replace( ".key.", ".index." ) ); -// } -// if ( result == null && propertyName.endsWith( ".key" ) ) { -// //support for legacy @AttributeOverride declarations -// //TODO cache the underlying regexp -// result = getExactOverriddenColumn( -// propertyName.substring( 0, propertyName.length() - ".key".length() ) + ".index" -// ); -// } -// if ( result == null && propertyName.contains( ".value." ) ) { -// //support for legacy @AttributeOverride declarations -// //TODO cache the underlying regexp -// result = getExactOverriddenColumn( propertyName.replace( ".value.", ".element." ) ); -// } -// if ( result == null && propertyName.endsWith( ".value" ) ) { -// //support for legacy @AttributeOverride declarations -// //TODO cache the underlying regexp -// result = getExactOverriddenColumn( -// propertyName.substring( 0, propertyName.length() - ".value".length() ) + ".element" -// ); -// } - if ( result == null && propertyName.contains( ".collection&&element." ) ) { - //support for non map collections where no prefix is needed - //TODO cache the underlying regexp - result = getExactOverriddenColumn( propertyName.replace( ".collection&&element.", "." ) ); - } + if ( result == null && propertyName.contains(".collection&&element.") ) { + //support for non map collections where no prefix is needed + result = getExactOverriddenColumn( propertyName.replace(".collection&&element.", ".") ); } return result; } @@ -303,7 +268,7 @@ public abstract class AbstractPropertyHolder implements PropertyHolder { /** * Get column overriding, property first, then parent, then holder * replace the placeholder 'collection&&element' with nothing - * + *

* These rules are here to support both JPA 2 and legacy overriding rules. */ @Override @@ -367,7 +332,7 @@ public abstract class AbstractPropertyHolder implements PropertyHolder { */ @Override public JoinTable getJoinTable(XProperty property) { - final String propertyName = StringHelper.qualify( getPath(), property.getName() ); + final String propertyName = qualify( getPath(), property.getName() ); JoinTable result = getOverriddenJoinTable( propertyName ); if (result == null) { result = property.getAnnotation( JoinTable.class ); @@ -415,8 +380,10 @@ public abstract class AbstractPropertyHolder implements PropertyHolder { Map joinColumnOverride = new HashMap<>(); Map joinTableOverride = new HashMap<>(); Map foreignKeyOverride = new HashMap<>(); - while ( current != null && !context.getBootstrapContext().getReflectionManager().toXClass( Object.class ).equals( current ) ) { - if ( current.isAnnotationPresent( Entity.class ) || current.isAnnotationPresent( MappedSuperclass.class ) + XClass objectClass = context.getBootstrapContext().getReflectionManager().toXClass(Object.class); + while ( current != null && !objectClass.equals( current ) ) { + if ( current.isAnnotationPresent( Entity.class ) + || current.isAnnotationPresent( MappedSuperclass.class ) || current.isAnnotationPresent( Embeddable.class ) ) { //FIXME is embeddable override? Map currentOverride = buildColumnOverride( current, getPath(), context ); @@ -438,18 +405,18 @@ public abstract class AbstractPropertyHolder implements PropertyHolder { current = current.getSuperclass(); } - holderColumnOverride = columnOverride.size() > 0 ? columnOverride : null; - holderColumnTransformerOverride = columnTransformerOverride.size() > 0 ? columnTransformerOverride : null; - holderJoinColumnOverride = joinColumnOverride.size() > 0 ? joinColumnOverride : null; - holderJoinTableOverride = joinTableOverride.size() > 0 ? joinTableOverride : null; - holderForeignKeyOverride = foreignKeyOverride.size() > 0 ? foreignKeyOverride : null; + holderColumnOverride = !columnOverride.isEmpty() ? columnOverride : null; + holderColumnTransformerOverride = !columnTransformerOverride.isEmpty() ? columnTransformerOverride : null; + holderJoinColumnOverride = !joinColumnOverride.isEmpty() ? joinColumnOverride : null; + holderJoinTableOverride = !joinTableOverride.isEmpty() ? joinTableOverride : null; + holderForeignKeyOverride = !foreignKeyOverride.isEmpty() ? foreignKeyOverride : null; } private static Map buildColumnOverride( XAnnotatedElement element, String path, MetadataBuildingContext context) { - Map columnOverride = new HashMap<>(); + final Map columnOverride = new HashMap<>(); if ( element != null ) { AttributeOverride singleOverride = element.getAnnotation( AttributeOverride.class ); AttributeOverrides multipleOverrides = element.getAnnotation( AttributeOverrides.class ); @@ -465,19 +432,18 @@ public abstract class AbstractPropertyHolder implements PropertyHolder { } if ( overrides != null ) { - Map> columnOverrideList = new HashMap<>(); + final Map> columnOverrideList = new HashMap<>(); for ( AttributeOverride depAttr : overrides ) { - String qualifiedName = StringHelper.qualify( path, depAttr.name() ); + final String qualifiedName = qualify( path, depAttr.name() ); if ( columnOverrideList.containsKey( qualifiedName ) ) { columnOverrideList.get( qualifiedName ).add( depAttr.column() ); } else { - columnOverrideList.put( - qualifiedName, - new ArrayList<>( Arrays.asList( depAttr.column() ) ) - ); + List list = new ArrayList<>(); + list.add( depAttr.column() ); + columnOverrideList.put( qualifiedName, list ); } } @@ -619,7 +585,7 @@ public abstract class AbstractPropertyHolder implements PropertyHolder { if ( overrides != null ) { for ( AssociationOverride depAttr : overrides ) { columnOverride.put( - StringHelper.qualify( path, depAttr.name() ), + qualify( path, depAttr.name() ), depAttr.joinColumns() ); } @@ -634,7 +600,7 @@ public abstract class AbstractPropertyHolder implements PropertyHolder { AssociationOverride[] overrides = buildAssociationOverrides( element, path ); if ( overrides != null ) { for ( AssociationOverride depAttr : overrides ) { - foreignKeyOverride.put( StringHelper.qualify( path, depAttr.name() ), depAttr.foreignKey() ); + foreignKeyOverride.put( qualify( path, depAttr.name() ), depAttr.foreignKey() ); } } } @@ -666,7 +632,7 @@ public abstract class AbstractPropertyHolder implements PropertyHolder { for ( AssociationOverride depAttr : overrides ) { if ( depAttr.joinColumns().length == 0 ) { tableOverride.put( - StringHelper.qualify( path, depAttr.name() ), + qualify( path, depAttr.name() ), depAttr.joinTable() ); } diff --git a/hibernate-core/src/main/java/org/hibernate/boot/model/internal/ComponentPropertyHolder.java b/hibernate-core/src/main/java/org/hibernate/boot/model/internal/ComponentPropertyHolder.java index c5d2a5fb5d..64c1c87004 100644 --- a/hibernate-core/src/main/java/org/hibernate/boot/model/internal/ComponentPropertyHolder.java +++ b/hibernate-core/src/main/java/org/hibernate/boot/model/internal/ComponentPropertyHolder.java @@ -14,14 +14,12 @@ import org.hibernate.annotations.common.reflection.XClass; import org.hibernate.annotations.common.reflection.XProperty; import org.hibernate.boot.spi.MetadataBuildingContext; import org.hibernate.boot.spi.PropertyData; -import org.hibernate.internal.util.StringHelper; import org.hibernate.mapping.Component; import org.hibernate.mapping.Join; import org.hibernate.mapping.KeyValue; import org.hibernate.mapping.PersistentClass; import org.hibernate.mapping.Property; import org.hibernate.mapping.Table; -import org.hibernate.spi.NavigablePath; import jakarta.persistence.Column; import jakarta.persistence.Convert; @@ -33,6 +31,8 @@ import jakarta.persistence.JoinTable; import static org.hibernate.boot.model.internal.HCANNHelper.hasAnnotation; import static org.hibernate.internal.util.StringHelper.isEmpty; +import static org.hibernate.internal.util.StringHelper.qualifyConditionally; +import static org.hibernate.spi.NavigablePath.IDENTIFIER_MAPPER_PROPERTY; /** * {@link PropertyHolder} for composites (Embeddable/Embedded). @@ -238,7 +238,7 @@ public class ComponentPropertyHolder extends AbstractPropertyHolder { @Override protected AttributeConversionInfo locateAttributeConversionInfo(String path) { - final String embeddedPath = StringHelper.qualifyConditionally( embeddedAttributeName, path ); + final String embeddedPath = qualifyConditionally( embeddedAttributeName, path ); final AttributeConversionInfo fromParent = parent.locateAttributeConversionInfo( embeddedPath ); if ( fromParent != null ) { return fromParent; @@ -357,7 +357,7 @@ public class ComponentPropertyHolder extends AbstractPropertyHolder { } } if ( result == null ) { - String userPropertyName = extractUserPropertyName( NavigablePath.IDENTIFIER_MAPPER_PROPERTY, propertyName ); + String userPropertyName = extractUserPropertyName( IDENTIFIER_MAPPER_PROPERTY, propertyName ); if ( userPropertyName != null ) { result = super.getOverriddenColumn( userPropertyName ); } diff --git a/hibernate-core/src/main/java/org/hibernate/boot/model/internal/EntityBinder.java b/hibernate-core/src/main/java/org/hibernate/boot/model/internal/EntityBinder.java index 4573432313..4b74698384 100644 --- a/hibernate-core/src/main/java/org/hibernate/boot/model/internal/EntityBinder.java +++ b/hibernate-core/src/main/java/org/hibernate/boot/model/internal/EntityBinder.java @@ -17,6 +17,10 @@ import java.util.Locale; import java.util.Map; import java.util.Set; +import jakarta.persistence.AssociationOverride; +import jakarta.persistence.AssociationOverrides; +import jakarta.persistence.AttributeOverride; +import jakarta.persistence.AttributeOverrides; import org.hibernate.AnnotationException; import org.hibernate.AssertionFailure; import org.hibernate.MappingException; @@ -85,6 +89,7 @@ import org.hibernate.engine.OptimisticLockStyle; import org.hibernate.engine.jdbc.env.spi.JdbcEnvironment; import org.hibernate.engine.spi.FilterDefinition; import org.hibernate.internal.CoreMessageLogger; +import org.hibernate.internal.util.StringHelper; import org.hibernate.jpa.event.spi.CallbackType; import org.hibernate.mapping.BasicValue; import org.hibernate.mapping.CheckConstraint; @@ -109,8 +114,6 @@ import org.hibernate.spi.NavigablePath; import org.jboss.logging.Logger; import jakarta.persistence.Access; -import jakarta.persistence.AttributeOverride; -import jakarta.persistence.AttributeOverrides; import jakarta.persistence.Cacheable; import jakarta.persistence.ConstraintMode; import jakarta.persistence.DiscriminatorColumn; @@ -120,7 +123,6 @@ import jakarta.persistence.ForeignKey; import jakarta.persistence.GeneratedValue; import jakarta.persistence.IdClass; import jakarta.persistence.Inheritance; -import jakarta.persistence.InheritanceType; import jakarta.persistence.JoinColumn; import jakarta.persistence.JoinTable; import jakarta.persistence.NamedEntityGraph; @@ -132,6 +134,7 @@ import jakarta.persistence.SecondaryTables; import jakarta.persistence.SharedCacheMode; import jakarta.persistence.UniqueConstraint; +import static jakarta.persistence.InheritanceType.SINGLE_TABLE; import static org.hibernate.boot.model.internal.AnnotatedClassType.MAPPED_SUPERCLASS; import static org.hibernate.boot.model.internal.AnnotatedDiscriminatorColumn.buildDiscriminatorColumn; import static org.hibernate.boot.model.internal.AnnotatedJoinColumn.buildInheritanceJoinColumn; @@ -217,9 +220,9 @@ public class EntityBinder { final InheritanceState inheritanceState = inheritanceStates.get( clazzToProcess ); final PersistentClass superEntity = getSuperEntity( clazzToProcess, inheritanceStates, context, inheritanceState ); - detectedAttributeOverrideProblem( clazzToProcess, superEntity ); - final PersistentClass persistentClass = makePersistentClass( inheritanceState, superEntity, context ); + checkOverrides( clazzToProcess, superEntity ); + final EntityBinder entityBinder = new EntityBinder( clazzToProcess, persistentClass, context ); entityBinder.bindEntity(); entityBinder.handleClassTable( inheritanceState, superEntity ); @@ -254,6 +257,53 @@ public class EntityBinder { entityBinder.callTypeBinders( persistentClass ); } + private static void checkOverrides(XClass clazzToProcess, PersistentClass superEntity) { + if ( superEntity != null ) { + //TODO: correctly handle compound paths (embeddables) + { + AttributeOverrides overrides = clazzToProcess.getAnnotation(AttributeOverrides.class); + if ( overrides != null ) { + for ( AttributeOverride override : overrides.value() ) { + checkOverride( superEntity, override.name(), clazzToProcess, AttributeOverride.class ); + } + } + AttributeOverride override = clazzToProcess.getAnnotation(AttributeOverride.class); + if ( override != null ) { + checkOverride( superEntity, override.name(), clazzToProcess, AttributeOverride.class ); + } + } + { + AssociationOverrides overrides = clazzToProcess.getAnnotation(AssociationOverrides.class); + if ( overrides != null ) { + for ( AssociationOverride override : overrides.value() ) { + checkOverride( superEntity, override.name(), clazzToProcess, AssociationOverride.class ); + } + } + AssociationOverride override = clazzToProcess.getAnnotation(AssociationOverride.class); + if ( override != null ) { + checkOverride( superEntity, override.name(), clazzToProcess, AssociationOverride.class ); + } + } + } + } + + /** + * The rule is that an entity can override a field declared by a @MappedSuperclass + * if there is no intervening entity which also inherits the field. A wrinkle is + * that a mapped superclass can occur in between the root class and a subclass of + * an entity hierarchy, and then the subclass can override fields declared by the + * mapped superclass even though it cannot override any fields of the root class. + */ + private static void checkOverride( + PersistentClass superEntity, String name, XClass clazzToProcess, Class overrideClass) { + if ( superEntity.hasProperty( StringHelper.root(name) ) ) { + throw new AnnotationException("Property '" + name + + "' is inherited from entity '" + superEntity.getEntityName() + + "' and may not be overridden using '@" + overrideClass.getSimpleName() + + "' in entity subclass '" + clazzToProcess.getName() + "'"); + } + } + private static void bindSoftDelete( XClass xClass, RootClass rootClass, @@ -371,14 +421,6 @@ public class EntityBinder { processComplementaryTableDefinitions( annotatedClass.getAnnotation( jakarta.persistence.Table.class ) ); } - private static void detectedAttributeOverrideProblem(XClass clazzToProcess, PersistentClass superEntity) { - if ( superEntity != null && ( - clazzToProcess.isAnnotationPresent( AttributeOverride.class ) || - clazzToProcess.isAnnotationPresent( AttributeOverrides.class ) ) ) { - LOG.unsupportedAttributeOverrideWithEntityInheritance( clazzToProcess.getName() ); - } - } - private Set handleIdClass( PersistentClass persistentClass, InheritanceState inheritanceState, @@ -718,11 +760,12 @@ public class EntityBinder { } else { if ( hasTableAnnotation ) { - //TODO: why is this not an error?! - LOG.invalidTableAnnotation( annotatedClass.getName() ); + throw new AnnotationException( "Entity '" + annotatedClass.getName() + + "' is a subclass in a 'SINGLE_TABLE' hierarchy and may not be annotated '@Table'" + + " (the root class declares the table mapping for the hierarchy)"); } - if ( inheritanceState.getType() == InheritanceType.SINGLE_TABLE ) { + if ( inheritanceState.getType() == SINGLE_TABLE ) { // we at least need to properly set up the EntityTableXref bindTableForDiscriminatedSubclass( collector.getEntityTableXref( superEntity.getEntityName() ) ); } @@ -776,11 +819,8 @@ public class EntityBinder { bindDiscriminatorValue(); if ( !isJoinedSubclass ) { - checkNoJoinColumns( annotatedClass ); - if ( annotatedClass.isAnnotationPresent( OnDelete.class ) ) { - //TODO: why is this not an error!?? - LOG.invalidOnDeleteAnnotation( propertyHolder.getEntityName() ); - } + checkNoJoinColumns(); + checkNoOnDelete(); } } @@ -833,11 +873,18 @@ public class EntityBinder { } } - private static void checkNoJoinColumns(XClass clazzToProcess) { - if ( clazzToProcess.isAnnotationPresent( PrimaryKeyJoinColumns.class ) - || clazzToProcess.isAnnotationPresent( PrimaryKeyJoinColumn.class ) ) { - //TODO: why is this not an error?! - LOG.invalidPrimaryKeyJoinColumnAnnotation( clazzToProcess.getName() ); + private void checkNoJoinColumns() { + if ( annotatedClass.isAnnotationPresent( PrimaryKeyJoinColumns.class ) + || annotatedClass.isAnnotationPresent( PrimaryKeyJoinColumn.class ) ) { + throw new AnnotationException( "Entity class '" + annotatedClass.getName() + + "' may not specify a '@PrimaryKeyJoinColumn'" ); + } + } + + private void checkNoOnDelete() { + if ( annotatedClass.isAnnotationPresent( OnDelete.class ) ) { + throw new AnnotationException( "Entity class '" + annotatedClass.getName() + + "' may not be annotated '@OnDelete'" ); } } @@ -1017,7 +1064,7 @@ public class EntityBinder { } else { boolean subclassAndSingleTableStrategy = - inheritanceState.getType() == InheritanceType.SINGLE_TABLE + inheritanceState.getType() == SINGLE_TABLE && inheritanceState.hasParents(); if ( !hasIdAnnotation && property.isAnnotationPresent( GeneratedValue.class ) ) { throw new AnnotationException( @@ -1274,7 +1321,9 @@ public class EntityBinder { bindRootEntity(); } else if ( !isMutable() ) { - LOG.immutableAnnotationOnNonRoot( annotatedClass.getName() ); + throw new AnnotationException("Entity class '" + annotatedClass.getName() + + "' is annotated '@Immutable' but it is a subclass in an entity inheritance hierarchy" + + " (only root classes may declare mutability)"); } ensureNoMutabilityPlan(); diff --git a/hibernate-core/src/main/java/org/hibernate/boot/registry/classloading/internal/ClassLoaderServiceImpl.java b/hibernate-core/src/main/java/org/hibernate/boot/registry/classloading/internal/ClassLoaderServiceImpl.java index 7460c14d00..53d2b369f9 100644 --- a/hibernate-core/src/main/java/org/hibernate/boot/registry/classloading/internal/ClassLoaderServiceImpl.java +++ b/hibernate-core/src/main/java/org/hibernate/boot/registry/classloading/internal/ClassLoaderServiceImpl.java @@ -254,15 +254,15 @@ public class ClassLoaderServiceImpl implements ClassLoaderService { @Override public Package packageForNameOrNull(String packageName) { try { - Class aClass = Class.forName( packageName + ".package-info", true, getAggregatedClassLoader() ); - return aClass == null ? null : aClass.getPackage(); + return Class.forName( packageName + ".package-info", true, getAggregatedClassLoader() ) + .getPackage(); } catch (ClassNotFoundException e) { log.packageNotFound( packageName ); return null; } catch (LinkageError e) { - log.warn( "LinkageError while attempting to load Package named " + packageName, e ); + log.linkageError( packageName, e ); return null; } } 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 7157f40cac..9b93b9e09b 100644 --- a/hibernate-core/src/main/java/org/hibernate/internal/CoreMessageLogger.java +++ b/hibernate-core/src/main/java/org/hibernate/internal/CoreMessageLogger.java @@ -388,10 +388,6 @@ public interface CoreMessageLogger extends BasicLogger { String name, String propertyName); - @LogMessage(level = WARN) - @Message(value = "@Immutable used on a non root entity: ignored for %s", id = 124) - void immutableAnnotationOnNonRoot(String className); - @LogMessage(level = WARN) @Message(value = "Mapping metadata cache was not completely processed", id = 125) void incompleteMappingMetadataCacheProcessing(); @@ -412,11 +408,6 @@ public interface CoreMessageLogger extends BasicLogger { @Message(value = "Array element type error\n%s", id = 132) void invalidArrayElementType(String message); - @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 invalidDiscriminatorAnnotation(String className); - @LogMessage(level = ERROR) @Message(value = "Application attempted to edit read only item: %s", id = 134) void invalidEditOfReadOnlyItem(Object key); @@ -427,23 +418,11 @@ public interface CoreMessageLogger extends BasicLogger { String name, @Cause JndiNameException e); - @LogMessage(level = WARN) - @Message(value = "Inapropriate use of @OnDelete on entity, annotation ignored: %s", id = 136) - void invalidOnDeleteAnnotation(String entityName); - - @LogMessage(level = WARN) - @Message(value = "Root entity should not hold a PrimaryKeyJoinColum(s), will be ignored: %s", id = 137) - void invalidPrimaryKeyJoinColumnAnnotation(String className); - @LogMessage(level = WARN) @Message(value = "Mixing inheritance strategy in a entity hierarchy is not allowed, ignoring sub strategy in: %s", id = 138) void invalidSubStrategy(String className); - @LogMessage(level = WARN) - @Message(value = "Illegal use of @Table in a subclass of a SINGLE_TABLE hierarchy: %s", id = 139) - void invalidTableAnnotation(String className); - @LogMessage(level = INFO) @Message(value = "JACC contextID: %s", id = 140) void jaccContextId(String contextId); @@ -555,21 +534,17 @@ public interface CoreMessageLogger extends BasicLogger { @Message(value = "Optimistic lock failures: %s", id = 187) void optimisticLockFailures(long optimisticFailureCount); - @LogMessage(level = WARN) - @Message(value = "@OrderBy not allowed for an indexed collection, annotation ignored.", id = 189) - void orderByAnnotationIndexedCollection(); - @LogMessage(level = WARN) @Message(value = "Overriding %s is dangerous, this might break the EJB3 specification implementation", id = 193) void overridingTransactionStrategyDangerous(String transactionStrategy); @LogMessage(level = DEBUG) - @Message(value = "Package not found or wo package-info.java: %s", id = 194) + @Message(value = "Package not found or no package-info.java: %s", id = 194) void packageNotFound(String packageName); -// @LogMessage(level = WARN) -// @Message(value = "Parameter position [%s] occurred as both JPA and Hibernate positional parameter", id = 195) -// void parameterPositionOccurredAsBothJpaAndHibernatePositionalParameter(Integer position); + @LogMessage(level = WARN) + @Message(value = "LinkageError while attempting to load package: %s", id = 195) + void linkageError(String packageName, @Cause LinkageError e); @LogMessage(level = ERROR) @Message(value = "Error parsing XML: (%s) %s", id = 196) @@ -753,10 +728,6 @@ public interface CoreMessageLogger extends BasicLogger { @Message(value = "Sessions opened: %s", id = 242) void sessionsOpened(long sessionOpenCount); - @LogMessage(level = WARN) - @Message(value = "@Sort not allowed for an indexed collection, annotation ignored.", id = 244) - void sortAnnotationIndexedCollection(); - @LogMessage(level = WARN) @Message(value = "Manipulation query [%s] resulted in [%s] split queries", id = 245) void splitQueries( @@ -1712,10 +1683,6 @@ public interface CoreMessageLogger extends BasicLogger { ) void unknownJavaTypeNoEqualsHashCode(Class javaType); - @LogMessage(level = WARN) - @Message(value = "@org.hibernate.annotations.Cache used on a non-root entity: ignored for [%s]. Please see the Hibernate documentation for proper usage.", id = 482) - void cacheOrCacheableAnnotationOnNonRoot(String className); - @LogMessage(level = WARN) @Message( id = 483, @@ -1794,20 +1761,6 @@ public interface CoreMessageLogger extends BasicLogger { @Message(value = "Detaching an uninitialized collection with queued operations from a session due to rollback: %s", id = 498) void queuedOperationWhenDetachFromSessionOnRollback(String collectionInfoString); - @LogMessage(level = WARN) - @Message(value = "Using @AttributeOverride or @AttributeOverrides in conjunction with entity inheritance is not supported: %s. The overriding definitions are ignored.", id = 499) - void unsupportedAttributeOverrideWithEntityInheritance(String entityName); - - /* 6.0 message loggers - @LogMessage(level = WARN) - @Message(value = "The bytecode provider class [%s] could not be loaded", id = 500) - void bytecodeProviderClassNotFound(String className); - - @LogMessage(level = WARN) - @Message(value = "The bytecode provider class [%s] does not implement BytecodeProvider", id = 501) - void bytecodeProviderInvalidClass(String className); - */ - @LogMessage(level = WARN) @Message(value = "The [%s] property of the [%s] entity was modified, but it won't be updated because the property is immutable.", id = 502) void ignoreImmutablePropertyModification(String propertyName, String entityName); diff --git a/hibernate-core/src/main/java/org/hibernate/mapping/JoinedSubclass.java b/hibernate-core/src/main/java/org/hibernate/mapping/JoinedSubclass.java index 9ab5451977..46c619e3a4 100644 --- a/hibernate-core/src/main/java/org/hibernate/mapping/JoinedSubclass.java +++ b/hibernate-core/src/main/java/org/hibernate/mapping/JoinedSubclass.java @@ -5,7 +5,7 @@ * See the lgpl.txt file in the root directory or . */ package org.hibernate.mapping; -import java.util.Iterator; + import java.util.List; import org.hibernate.MappingException; diff --git a/hibernate-core/src/main/java/org/hibernate/mapping/SingleTableSubclass.java b/hibernate-core/src/main/java/org/hibernate/mapping/SingleTableSubclass.java index 39adfd14b4..204f56df3d 100644 --- a/hibernate-core/src/main/java/org/hibernate/mapping/SingleTableSubclass.java +++ b/hibernate-core/src/main/java/org/hibernate/mapping/SingleTableSubclass.java @@ -6,7 +6,6 @@ */ package org.hibernate.mapping; -import java.util.Iterator; import java.util.List; import org.hibernate.MappingException; diff --git a/hibernate-core/src/main/java/org/hibernate/mapping/Subclass.java b/hibernate-core/src/main/java/org/hibernate/mapping/Subclass.java index 545dd53356..600560f772 100644 --- a/hibernate-core/src/main/java/org/hibernate/mapping/Subclass.java +++ b/hibernate-core/src/main/java/org/hibernate/mapping/Subclass.java @@ -8,7 +8,6 @@ package org.hibernate.mapping; import java.util.ArrayList; import java.util.HashSet; -import java.util.Iterator; import java.util.List; import org.hibernate.boot.spi.MetadataBuildingContext; diff --git a/hibernate-core/src/main/java/org/hibernate/mapping/UnionSubclass.java b/hibernate-core/src/main/java/org/hibernate/mapping/UnionSubclass.java index 80b71752f1..3aa0ecd3f5 100644 --- a/hibernate-core/src/main/java/org/hibernate/mapping/UnionSubclass.java +++ b/hibernate-core/src/main/java/org/hibernate/mapping/UnionSubclass.java @@ -5,7 +5,7 @@ * See the lgpl.txt file in the root directory or . */ package org.hibernate.mapping; -import java.util.Iterator; + import java.util.List; import org.hibernate.boot.spi.MetadataBuildingContext; diff --git a/hibernate-core/src/test/java/org/hibernate/orm/test/annotations/inheritance/mixed/Document.java b/hibernate-core/src/test/java/org/hibernate/orm/test/annotations/inheritance/mixed/Document.java index 2991610475..7f9ece3688 100644 --- a/hibernate-core/src/test/java/org/hibernate/orm/test/annotations/inheritance/mixed/Document.java +++ b/hibernate-core/src/test/java/org/hibernate/orm/test/annotations/inheritance/mixed/Document.java @@ -11,7 +11,6 @@ import jakarta.persistence.Column; import jakarta.persistence.DiscriminatorValue; import jakarta.persistence.Entity; import jakarta.persistence.SecondaryTable; -import jakarta.persistence.Table; /** * @author Emmanuel Bernard @@ -19,7 +18,6 @@ import jakarta.persistence.Table; @Entity @DiscriminatorValue("D") @SecondaryTable(name = "DocumentMixed") -@Table(name="Document_Wrong") //illegal use, a warn is raised public class Document extends File { private int size; diff --git a/hibernate-core/src/test/java/org/hibernate/orm/test/annotations/override/inheritance/EntityInheritanceAttributeOverrideTest.java b/hibernate-core/src/test/java/org/hibernate/orm/test/annotations/override/inheritance/EntityInheritanceAttributeOverrideTest.java index b5f0ccb06d..fc0923bfd9 100644 --- a/hibernate-core/src/test/java/org/hibernate/orm/test/annotations/override/inheritance/EntityInheritanceAttributeOverrideTest.java +++ b/hibernate-core/src/test/java/org/hibernate/orm/test/annotations/override/inheritance/EntityInheritanceAttributeOverrideTest.java @@ -6,29 +6,25 @@ */ package org.hibernate.orm.test.annotations.override.inheritance; -import org.hibernate.boot.model.internal.EntityBinder; -import org.hibernate.internal.CoreMessageLogger; - -import org.hibernate.testing.TestForIssue; -import org.hibernate.testing.logger.LoggerInspectionRule; -import org.hibernate.testing.logger.Triggerable; -import org.hibernate.testing.orm.junit.EntityManagerFactoryBasedFunctionalTest; -import org.junit.Rule; -import org.junit.jupiter.api.Test; - -import org.jboss.logging.Logger; - import jakarta.persistence.AttributeOverride; import jakarta.persistence.Column; import jakarta.persistence.Entity; -import jakarta.persistence.EntityManagerFactory; import jakarta.persistence.Id; import jakarta.persistence.Inheritance; import jakarta.persistence.InheritanceType; import jakarta.persistence.Table; import jakarta.persistence.UniqueConstraint; +import org.hibernate.AnnotationException; +import org.hibernate.boot.model.internal.EntityBinder; +import org.hibernate.internal.CoreMessageLogger; +import org.hibernate.testing.TestForIssue; +import org.hibernate.testing.logger.LoggerInspectionRule; +import org.hibernate.testing.orm.junit.EntityManagerFactoryBasedFunctionalTest; +import org.jboss.logging.Logger; +import org.junit.Rule; +import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertTrue; +import static org.junit.jupiter.api.Assertions.fail; /** @@ -50,19 +46,15 @@ public class EntityInheritanceAttributeOverrideTest extends EntityManagerFactory }; } - @Override - public EntityManagerFactory produceEntityManagerFactory() { - Triggerable warningLogged = logInspection.watchForLogMessages( "HHH000499:" ); - - EntityManagerFactory entityManagerFactory = super.produceEntityManagerFactory(); - - assertTrue( warningLogged.wasTriggered(), "A warning should have been logged for this unsupported configuration"); - return entityManagerFactory; - } - @Test public void test() { - produceEntityManagerFactory().close(); + try { + produceEntityManagerFactory().close(); + fail(); + } + catch (AnnotationException ae) { + //expected + } } @Entity(name = "AbstractEntity") diff --git a/hibernate-core/src/test/java/org/hibernate/orm/test/bootstrap/binding/annotations/attributeOverrides/TablePerClassOverrideTests.java b/hibernate-core/src/test/java/org/hibernate/orm/test/bootstrap/binding/annotations/attributeOverrides/TablePerClassOverrideTests.java index 5ba470d6c0..a546aac422 100644 --- a/hibernate-core/src/test/java/org/hibernate/orm/test/bootstrap/binding/annotations/attributeOverrides/TablePerClassOverrideTests.java +++ b/hibernate-core/src/test/java/org/hibernate/orm/test/bootstrap/binding/annotations/attributeOverrides/TablePerClassOverrideTests.java @@ -48,10 +48,10 @@ import static org.junit.jupiter.api.Assertions.assertTrue; ) @ServiceRegistry @SessionFactory +@Disabled("@AttributeOverrides is not supported for inheritance.") public class TablePerClassOverrideTests { @Test - @Disabled("@AttributeOverrides is not supported for inheritance. See CoreMessageLogger#unsupportedAttributeOverrideWithEntityInheritance") public void testSchema(SessionFactoryScope scope) { MetadataImplementor metadata = scope.getMetadataImplementor(); assertTrue( SchemaUtil.isColumnPresent( "CUSTOMER", "STREET", metadata ) ); diff --git a/hibernate-core/src/test/java/org/hibernate/orm/test/cfg/AnnotationBinderTest.java b/hibernate-core/src/test/java/org/hibernate/orm/test/cfg/AnnotationBinderTest.java index 3f47a31789..6c73197acf 100644 --- a/hibernate-core/src/test/java/org/hibernate/orm/test/cfg/AnnotationBinderTest.java +++ b/hibernate-core/src/test/java/org/hibernate/orm/test/cfg/AnnotationBinderTest.java @@ -6,26 +6,17 @@ */ package org.hibernate.orm.test.cfg; -import org.hibernate.boot.Metadata; -import org.hibernate.boot.MetadataSources; -import org.hibernate.boot.model.internal.EntityBinder; -import org.hibernate.boot.registry.StandardServiceRegistry; -import org.hibernate.internal.CoreMessageLogger; - -import org.hibernate.testing.TestForIssue; -import org.hibernate.testing.logger.LoggerInspectionRule; -import org.hibernate.testing.logger.Triggerable; -import org.hibernate.testing.util.ServiceRegistryUtil; -import org.junit.Rule; -import org.junit.Test; - -import org.jboss.logging.Logger; - import jakarta.persistence.Entity; import jakarta.persistence.Id; import jakarta.persistence.PrimaryKeyJoinColumn; +import org.hibernate.AnnotationException; +import org.hibernate.boot.MetadataSources; +import org.hibernate.boot.registry.StandardServiceRegistry; +import org.hibernate.testing.TestForIssue; +import org.hibernate.testing.util.ServiceRegistryUtil; +import org.junit.Test; -import static org.junit.Assert.assertTrue; +import static junit.framework.TestCase.fail; /** * @author Dominique Toupin @@ -33,27 +24,18 @@ import static org.junit.Assert.assertTrue; @TestForIssue(jiraKey = "HHH-10456") public class AnnotationBinderTest { - @Rule - public LoggerInspectionRule logInspection = new LoggerInspectionRule( - Logger.getMessageLogger( CoreMessageLogger.class, EntityBinder.class.getName() ) ); - @Test - public void testInvalidPrimaryKeyJoinColumnAnnotationMessageContainsClassName() throws Exception { - - Triggerable triggerable = logInspection.watchForLogMessages( "HHH000137" ); - + public void testInvalidPrimaryKeyJoinColumn() { try (StandardServiceRegistry serviceRegistry = ServiceRegistryUtil.serviceRegistry()) { - - Metadata metadata = new MetadataSources( serviceRegistry ) - .addAnnotatedClass( InvalidPrimaryKeyJoinColumnAnnotationEntity.class ) - .buildMetadata(); - - assertTrue( "Expected warning HHH00137 but it wasn't triggered", triggerable.wasTriggered() ); - assertTrue( - "Expected invalid class name in warning HHH00137 message but it does not appear to be present; got " + triggerable.triggerMessage(), - triggerable.triggerMessage() - .matches( ".*\\b\\Q" + InvalidPrimaryKeyJoinColumnAnnotationEntity.class.getName() + "\\E\\b.*" ) - ); + try { + new MetadataSources( serviceRegistry ) + .addAnnotatedClass( InvalidPrimaryKeyJoinColumnAnnotationEntity.class ) + .buildMetadata(); + fail(); + } + catch (AnnotationException ae) { + // expected! + } } } diff --git a/hibernate-core/src/test/java/org/hibernate/orm/test/filter/subclass/singletable/Human.java b/hibernate-core/src/test/java/org/hibernate/orm/test/filter/subclass/singletable/Human.java index d4461c44bf..533ea85acc 100644 --- a/hibernate-core/src/test/java/org/hibernate/orm/test/filter/subclass/singletable/Human.java +++ b/hibernate-core/src/test/java/org/hibernate/orm/test/filter/subclass/singletable/Human.java @@ -8,14 +8,12 @@ package org.hibernate.orm.test.filter.subclass.singletable; import jakarta.persistence.Column; import jakarta.persistence.Entity; -import jakarta.persistence.Table; import org.hibernate.annotations.Filter; import org.hibernate.annotations.FilterDef; import org.hibernate.annotations.ParamDef; @Entity -@Table(name="ZOOLOGY_HUMAN") @FilterDef(name="iqRange", parameters= { @ParamDef(name="min", type=Integer.class), diff --git a/hibernate-core/src/test/java/org/hibernate/orm/test/filter/subclass/singletable/Mammal.java b/hibernate-core/src/test/java/org/hibernate/orm/test/filter/subclass/singletable/Mammal.java index 9540ff4a89..3bc8bcd5e5 100644 --- a/hibernate-core/src/test/java/org/hibernate/orm/test/filter/subclass/singletable/Mammal.java +++ b/hibernate-core/src/test/java/org/hibernate/orm/test/filter/subclass/singletable/Mammal.java @@ -16,10 +16,9 @@ import jakarta.persistence.Entity; import jakarta.persistence.Table; @Entity -@Table(name="ZOOLOGY_MAMMAL") @FilterDef(name="pregnantOnly") @Filter(name="pregnantOnly", condition="IS_PREGNANT = 1") -public class Mammal extends Animal{ +public class Mammal extends Animal { @Column(name="IS_PREGNANT") @Convert( converter = NumericBooleanConverter.class ) diff --git a/hibernate-core/src/test/java/org/hibernate/orm/test/inheritance/discriminator/embeddable/SingleTableWithEmbeddableTest.java b/hibernate-core/src/test/java/org/hibernate/orm/test/inheritance/discriminator/embeddable/SingleTableWithEmbeddableTest.java index 1e93610407..c1f0d92c8d 100644 --- a/hibernate-core/src/test/java/org/hibernate/orm/test/inheritance/discriminator/embeddable/SingleTableWithEmbeddableTest.java +++ b/hibernate-core/src/test/java/org/hibernate/orm/test/inheritance/discriminator/embeddable/SingleTableWithEmbeddableTest.java @@ -108,7 +108,6 @@ public class SingleTableWithEmbeddableTest { } @Entity(name = "Employee") - @Table(name = "employees") public static class Employee extends Person { private Integer employeeNumber; diff --git a/hibernate-core/src/test/java/org/hibernate/orm/test/insertordering/InsertOrderingWithSecondaryTable.java b/hibernate-core/src/test/java/org/hibernate/orm/test/insertordering/InsertOrderingWithSecondaryTable.java index 0ac4ed2d1a..92953f630c 100644 --- a/hibernate-core/src/test/java/org/hibernate/orm/test/insertordering/InsertOrderingWithSecondaryTable.java +++ b/hibernate-core/src/test/java/org/hibernate/orm/test/insertordering/InsertOrderingWithSecondaryTable.java @@ -112,7 +112,6 @@ public class InsertOrderingWithSecondaryTable extends BaseInsertOrderingTest { @Entity(name = "ShapePolygonEntity") @DiscriminatorValue("POLYGON") - @Table(name = "POLYGON") public static class ShapePolygonEntity extends ShapeEntity { } @@ -120,7 +119,6 @@ public class InsertOrderingWithSecondaryTable extends BaseInsertOrderingTest { @Entity(name = "ShapeCircleEntity") @DiscriminatorValue("CIRCLE") @SecondaryTable(name = "SHAPE_CIRCLE", pkJoinColumns = @PrimaryKeyJoinColumn(name = "SHAPE_ID")) - @Table(name = "CIRCLE") public static class ShapeCircleEntity extends ShapeEntity { @Column(table = "SHAPE_CIRCLE") private String centre; diff --git a/hibernate-core/src/test/java/org/hibernate/orm/test/jpa/criteria/Elephant.java b/hibernate-core/src/test/java/org/hibernate/orm/test/jpa/criteria/Elephant.java index 63e72519eb..daca4ed044 100644 --- a/hibernate-core/src/test/java/org/hibernate/orm/test/jpa/criteria/Elephant.java +++ b/hibernate-core/src/test/java/org/hibernate/orm/test/jpa/criteria/Elephant.java @@ -13,6 +13,5 @@ import jakarta.persistence.Table; * Elephant */ @Entity -@Table(name = "ELEPHANT") public class Elephant extends Animal { } diff --git a/hibernate-core/src/test/java/org/hibernate/orm/test/jpa/criteria/Human.java b/hibernate-core/src/test/java/org/hibernate/orm/test/jpa/criteria/Human.java index acdcf79389..84c341ff17 100644 --- a/hibernate-core/src/test/java/org/hibernate/orm/test/jpa/criteria/Human.java +++ b/hibernate-core/src/test/java/org/hibernate/orm/test/jpa/criteria/Human.java @@ -13,6 +13,5 @@ import jakarta.persistence.Table; * Human */ @Entity -@Table(name = "HUMAN") public class Human extends Animal { } diff --git a/hibernate-core/src/test/java/org/hibernate/orm/test/jpa/criteria/components/EntitySuperclassComponentWithCollectionTest.java b/hibernate-core/src/test/java/org/hibernate/orm/test/jpa/criteria/components/EntitySuperclassComponentWithCollectionTest.java index 87127811ba..029eb3d7d7 100644 --- a/hibernate-core/src/test/java/org/hibernate/orm/test/jpa/criteria/components/EntitySuperclassComponentWithCollectionTest.java +++ b/hibernate-core/src/test/java/org/hibernate/orm/test/jpa/criteria/components/EntitySuperclassComponentWithCollectionTest.java @@ -170,7 +170,6 @@ public class EntitySuperclassComponentWithCollectionTest { } @Entity(name = "Manager") - @Table(name = "MANAGER") public static class Manager extends Employee { } @@ -275,7 +274,6 @@ public class EntitySuperclassComponentWithCollectionTest { } @Entity(name = "Leader") - @Table(name = "LEADER") public static class Leader extends Person { } diff --git a/hibernate-core/src/test/java/org/hibernate/orm/test/query/hhh12076/AnnotationMappingJoinClassTest.java b/hibernate-core/src/test/java/org/hibernate/orm/test/query/hhh12076/AnnotationMappingJoinClassTest.java index f7be922988..164fd4b71d 100644 --- a/hibernate-core/src/test/java/org/hibernate/orm/test/query/hhh12076/AnnotationMappingJoinClassTest.java +++ b/hibernate-core/src/test/java/org/hibernate/orm/test/query/hhh12076/AnnotationMappingJoinClassTest.java @@ -348,7 +348,6 @@ public class AnnotationMappingJoinClassTest extends BaseCoreFunctionalTestCase { } @Entity(name = "EwtAssessmentExtension") - @Table(name = "claimsettlement_ext_i3_ewt") public static class EwtAssessmentExtension extends SettlementExtension { public static final long serialVersionUID = 1L; @@ -630,7 +629,6 @@ public class AnnotationMappingJoinClassTest extends BaseCoreFunctionalTestCase { } @Entity(name = "GapAssessmentExtension") - @Table(name = "claim_settlement_ext_gap") public static class GapAssessmentExtension extends SettlementExtension { private Double insuredsObligation = 0.0; diff --git a/hibernate-core/src/test/java/org/hibernate/orm/test/query/hql/joinorder/JoinOrderTest.java b/hibernate-core/src/test/java/org/hibernate/orm/test/query/hql/joinorder/JoinOrderTest.java index 75ccb663ed..d5a9f63507 100644 --- a/hibernate-core/src/test/java/org/hibernate/orm/test/query/hql/joinorder/JoinOrderTest.java +++ b/hibernate-core/src/test/java/org/hibernate/orm/test/query/hql/joinorder/JoinOrderTest.java @@ -34,7 +34,6 @@ public class JoinOrderTest { } @Entity(name = "TaskLocation") - @Table(name = "vin_task_location") public class TaskLocation extends Location { @Id @GeneratedValue Long id; diff --git a/hibernate-core/src/test/java/org/hibernate/orm/test/query/hql/treat/DiscriminatedTreatSmokeTesting.java b/hibernate-core/src/test/java/org/hibernate/orm/test/query/hql/treat/DiscriminatedTreatSmokeTesting.java index 4f262052e2..202c2dadef 100644 --- a/hibernate-core/src/test/java/org/hibernate/orm/test/query/hql/treat/DiscriminatedTreatSmokeTesting.java +++ b/hibernate-core/src/test/java/org/hibernate/orm/test/query/hql/treat/DiscriminatedTreatSmokeTesting.java @@ -128,7 +128,6 @@ public class DiscriminatedTreatSmokeTesting { } @Entity( name = "ExtendedVolume" ) - @Table( name = "treated_extended_volume" ) @DiscriminatorValue( "E" ) public static class ExtendedVolume extends Volume { private String strategy; diff --git a/hibernate-core/src/test/java/org/hibernate/orm/test/query/hql/treat/DiscriminatedTreatSqmSmokeTesting.java b/hibernate-core/src/test/java/org/hibernate/orm/test/query/hql/treat/DiscriminatedTreatSqmSmokeTesting.java index edda25e56e..7ef1e9c1fc 100644 --- a/hibernate-core/src/test/java/org/hibernate/orm/test/query/hql/treat/DiscriminatedTreatSqmSmokeTesting.java +++ b/hibernate-core/src/test/java/org/hibernate/orm/test/query/hql/treat/DiscriminatedTreatSqmSmokeTesting.java @@ -127,7 +127,6 @@ public class DiscriminatedTreatSqmSmokeTesting { } @Entity( name = "ExtendedVolume" ) - @Table( name = "treated_extended_volume" ) @DiscriminatorValue( "E" ) public static class ExtendedVolume extends Volume { private String strategy; diff --git a/hibernate-core/src/test/java/org/hibernate/orm/test/tool/schema/IndividuallySchemaValidatorImplTest.java b/hibernate-core/src/test/java/org/hibernate/orm/test/tool/schema/IndividuallySchemaValidatorImplTest.java index 9c0917a859..dfb7a60abf 100644 --- a/hibernate-core/src/test/java/org/hibernate/orm/test/tool/schema/IndividuallySchemaValidatorImplTest.java +++ b/hibernate-core/src/test/java/org/hibernate/orm/test/tool/schema/IndividuallySchemaValidatorImplTest.java @@ -14,7 +14,6 @@ import java.util.Map; import java.util.Properties; import jakarta.persistence.Entity; import jakarta.persistence.Id; -import jakarta.persistence.PrimaryKeyJoinColumn; import jakarta.persistence.Table; import org.hibernate.boot.MetadataSources; @@ -294,7 +293,6 @@ public class IndividuallySchemaValidatorImplTest extends BaseUnitTestCase { } @Entity - @PrimaryKeyJoinColumn @Table(name = "UnqualifiedMissingEntity") public static class UnqualifiedMissingEntity { @@ -311,7 +309,6 @@ public class IndividuallySchemaValidatorImplTest extends BaseUnitTestCase { } @Entity - @PrimaryKeyJoinColumn @Table(name = "MissingEntity", catalog = "SomeCatalog", schema = "SomeSchema") public static class MissingEntity { @@ -328,7 +325,6 @@ public class IndividuallySchemaValidatorImplTest extends BaseUnitTestCase { } @Entity - @PrimaryKeyJoinColumn @Table(name = "ColumnEntity", schema = "SomeSchema") public static class NoNameColumn { @@ -345,7 +341,6 @@ public class IndividuallySchemaValidatorImplTest extends BaseUnitTestCase { } @Entity - @PrimaryKeyJoinColumn @Table(name = "ColumnEntity", schema = "SomeSchema") public static class NameColumn { @@ -372,7 +367,6 @@ public class IndividuallySchemaValidatorImplTest extends BaseUnitTestCase { } @Entity - @PrimaryKeyJoinColumn @Table(name = "ColumnEntity", schema = "SomeSchema") public static class IntegerNameColumn { diff --git a/hibernate-envers/src/test/java/org/hibernate/envers/test/integration/manytoone/lazy/ChildUser.java b/hibernate-envers/src/test/java/org/hibernate/envers/test/integration/manytoone/lazy/ChildUser.java index 09de313409..eb0854cb2b 100644 --- a/hibernate-envers/src/test/java/org/hibernate/envers/test/integration/manytoone/lazy/ChildUser.java +++ b/hibernate-envers/src/test/java/org/hibernate/envers/test/integration/manytoone/lazy/ChildUser.java @@ -12,14 +12,12 @@ import jakarta.persistence.CascadeType; import jakarta.persistence.Entity; import jakarta.persistence.FetchType; import jakarta.persistence.OneToMany; -import jakarta.persistence.Table; import java.util.List; /** * @author Luke Chen */ @Entity -@Table(name = "child_user") public class ChildUser extends User { @OneToMany(fetch = FetchType.LAZY, mappedBy = "user", cascade = CascadeType.REMOVE) diff --git a/hibernate-envers/src/test/java/org/hibernate/orm/test/envers/entities/onetomany/detached/ListJoinColumnBidirectionalInheritanceRefEdChildEntity.java b/hibernate-envers/src/test/java/org/hibernate/orm/test/envers/entities/onetomany/detached/ListJoinColumnBidirectionalInheritanceRefEdChildEntity.java index 26d38c5893..7be4d061ed 100644 --- a/hibernate-envers/src/test/java/org/hibernate/orm/test/envers/entities/onetomany/detached/ListJoinColumnBidirectionalInheritanceRefEdChildEntity.java +++ b/hibernate-envers/src/test/java/org/hibernate/orm/test/envers/entities/onetomany/detached/ListJoinColumnBidirectionalInheritanceRefEdChildEntity.java @@ -8,7 +8,6 @@ package org.hibernate.orm.test.envers.entities.onetomany.detached; import jakarta.persistence.DiscriminatorValue; import jakarta.persistence.Entity; -import jakarta.persistence.Table; import org.hibernate.envers.Audited; @@ -19,7 +18,6 @@ import org.hibernate.envers.Audited; * @author Adam Warski (adam at warski dot org) */ @Entity -@Table(name = "ListJoinColBiInhRefEdChild") @DiscriminatorValue("2") @Audited public class ListJoinColumnBidirectionalInheritanceRefEdChildEntity diff --git a/hibernate-testing/src/main/java/org/hibernate/testing/orm/junit/EntityManagerFactoryBasedFunctionalTest.java b/hibernate-testing/src/main/java/org/hibernate/testing/orm/junit/EntityManagerFactoryBasedFunctionalTest.java index ffb0606491..c3ffdbceec 100644 --- a/hibernate-testing/src/main/java/org/hibernate/testing/orm/junit/EntityManagerFactoryBasedFunctionalTest.java +++ b/hibernate-testing/src/main/java/org/hibernate/testing/orm/junit/EntityManagerFactoryBasedFunctionalTest.java @@ -9,8 +9,6 @@ package org.hibernate.testing.orm.junit; import java.net.URL; import java.util.ArrayList; import java.util.Arrays; -import java.util.Collection; -import java.util.Collections; import java.util.HashMap; import java.util.List; import java.util.Map; @@ -29,12 +27,9 @@ import org.hibernate.query.sqm.mutation.internal.temptable.GlobalTemporaryTableM import org.hibernate.query.sqm.mutation.internal.temptable.LocalTemporaryTableMutationStrategy; import org.hibernate.query.sqm.mutation.internal.temptable.PersistentTableStrategy; -import org.hibernate.testing.jdbc.SharedDriverManagerConnectionProviderImpl; import org.hibernate.testing.util.ServiceRegistryUtil; import org.junit.jupiter.api.AfterEach; -import org.jboss.logging.Logger; - import jakarta.persistence.EntityManager; import jakarta.persistence.EntityManagerFactory; import jakarta.persistence.SharedCacheMode; @@ -49,7 +44,6 @@ import static org.hibernate.testing.transaction.TransactionUtil.doInJPA; @FunctionalEntityManagerFactoryTesting public class EntityManagerFactoryBasedFunctionalTest implements EntityManagerFactoryProducer, EntityManagerFactoryScopeContainer { - private static final Logger log = Logger.getLogger( EntityManagerFactoryBasedFunctionalTest.class ); private EntityManagerFactoryScope entityManagerFactoryScope;