From 0ae432f0fba261409ae1ac550ed6b0f5bcf741e1 Mon Sep 17 00:00:00 2001 From: Gavin Date: Fri, 9 Jun 2023 00:45:10 +0200 Subject: [PATCH] misc minor changes --- .../metamodel/internal/AttributeFactory.java | 3 +- .../model/domain/AbstractManagedType.java | 2 +- .../internal/MappedSuperclassTypeImpl.java | 30 +++++++++++++++---- .../entity/AbstractEntityPersister.java | 2 +- .../main/java/org/hibernate/type/AnyType.java | 2 +- .../org/hibernate/type/ComponentType.java | 2 +- .../TransientOverrideAsPersistentJoined.java | 2 +- 7 files changed, 32 insertions(+), 11 deletions(-) diff --git a/hibernate-core/src/main/java/org/hibernate/metamodel/internal/AttributeFactory.java b/hibernate-core/src/main/java/org/hibernate/metamodel/internal/AttributeFactory.java index 364d19265a..1cf862ae0c 100644 --- a/hibernate-core/src/main/java/org/hibernate/metamodel/internal/AttributeFactory.java +++ b/hibernate-core/src/main/java/org/hibernate/metamodel/internal/AttributeFactory.java @@ -677,7 +677,8 @@ public class AttributeFactory { final AttributeMapping attributeMapping = embeddable.findAttributeMapping( attributeName ); if ( attributeMapping == null ) { throw new PropertyNotFoundException( - "Unable to locate property named " + attributeName + " on " + embeddable.getJavaType().getJavaTypeClass().getName() + "Unable to locate property named '" + attributeName + + "' of '" + embeddable.getJavaType().getJavaTypeClass().getName() + "'" ); } diff --git a/hibernate-core/src/main/java/org/hibernate/metamodel/model/domain/AbstractManagedType.java b/hibernate-core/src/main/java/org/hibernate/metamodel/model/domain/AbstractManagedType.java index 3cda82677e..f046a90ed5 100644 --- a/hibernate-core/src/main/java/org/hibernate/metamodel/model/domain/AbstractManagedType.java +++ b/hibernate-core/src/main/java/org/hibernate/metamodel/model/domain/AbstractManagedType.java @@ -185,7 +185,7 @@ public abstract class AbstractManagedType new SemanticException( String.format( Locale.ROOT, - "Could not resolve attribute '%s' of '%s' due to the attribute being declared in multiple sub types: ['%s', '%s']", + "Could not resolve attribute '%s' of '%s' due to the attribute being declared in multiple subtypes: ['%s', '%s']", name, getTypeName(), attribute.getDeclaringType().getTypeName(), diff --git a/hibernate-core/src/main/java/org/hibernate/metamodel/model/domain/internal/MappedSuperclassTypeImpl.java b/hibernate-core/src/main/java/org/hibernate/metamodel/model/domain/internal/MappedSuperclassTypeImpl.java index ebbcd7e7d9..0cd89001b0 100644 --- a/hibernate-core/src/main/java/org/hibernate/metamodel/model/domain/internal/MappedSuperclassTypeImpl.java +++ b/hibernate-core/src/main/java/org/hibernate/metamodel/model/domain/internal/MappedSuperclassTypeImpl.java @@ -26,23 +26,43 @@ import org.hibernate.type.descriptor.java.JavaType; * @author Steve Ebersole */ public class MappedSuperclassTypeImpl extends AbstractIdentifiableType implements MappedSuperclassDomainType { + + public MappedSuperclassTypeImpl( + String name, + boolean hasIdClass, + boolean hasIdProperty, + boolean hasVersion, + JavaType javaType, + IdentifiableDomainType superType, + JpaMetamodelImplementor jpaMetamodel) { + super( + name, + javaType, + superType, + hasIdClass, + hasIdProperty, + hasVersion, + jpaMetamodel + ); + } + public MappedSuperclassTypeImpl( JavaType javaType, MappedSuperclass mappedSuperclass, IdentifiableDomainType superType, JpaMetamodelImplementor jpaMetamodel) { - super( + this( javaType.getJavaType().getTypeName(), - javaType, - superType, - mappedSuperclass.getDeclaredIdentifierMapper() != null || ( superType != null && superType.hasIdClass() ), + mappedSuperclass.getDeclaredIdentifierMapper() != null + || superType != null && superType.hasIdClass(), mappedSuperclass.hasIdentifierProperty(), mappedSuperclass.isVersioned(), + javaType, + superType, jpaMetamodel ); } - @Override public String getPathName() { return getTypeName(); diff --git a/hibernate-core/src/main/java/org/hibernate/persister/entity/AbstractEntityPersister.java b/hibernate-core/src/main/java/org/hibernate/persister/entity/AbstractEntityPersister.java index 1915aa08db..fe504874ab 100644 --- a/hibernate-core/src/main/java/org/hibernate/persister/entity/AbstractEntityPersister.java +++ b/hibernate-core/src/main/java/org/hibernate/persister/entity/AbstractEntityPersister.java @@ -5722,7 +5722,7 @@ public abstract class AbstractEntityPersister new SemanticException( String.format( Locale.ROOT, - "Could not resolve attribute '%s' of '%s' due to the attribute being declared in multiple sub types: ['%s', '%s']", + "Could not resolve attribute '%s' of '%s' due to the attribute being declared in multiple subtypes: ['%s', '%s']", name, getJavaType().getJavaType().getTypeName(), attribute.asAttributeMapping().getDeclaringType() diff --git a/hibernate-core/src/main/java/org/hibernate/type/AnyType.java b/hibernate-core/src/main/java/org/hibernate/type/AnyType.java index 52e601de42..657a00f7d7 100644 --- a/hibernate-core/src/main/java/org/hibernate/type/AnyType.java +++ b/hibernate-core/src/main/java/org/hibernate/type/AnyType.java @@ -345,7 +345,7 @@ public class AnyType extends AbstractType implements CompositeType, AssociationT return 1; } - throw new PropertyNotFoundException( "Unable to locate property named " + name + " on AnyType" ); + throw new PropertyNotFoundException( "Unable to locate property named '" + name + "'" ); } @Override diff --git a/hibernate-core/src/main/java/org/hibernate/type/ComponentType.java b/hibernate-core/src/main/java/org/hibernate/type/ComponentType.java index b9b7e2241a..482205901b 100644 --- a/hibernate-core/src/main/java/org/hibernate/type/ComponentType.java +++ b/hibernate-core/src/main/java/org/hibernate/type/ComponentType.java @@ -726,7 +726,7 @@ public class ComponentType extends AbstractType implements CompositeTypeImplemen } } throw new PropertyNotFoundException( - "Unable to locate property named " + name + " on " + getReturnedClass().getName() + "Unable to locate property named '" + name + "' of '" + getReturnedClass().getName() + "'" ); } diff --git a/hibernate-core/src/test/java/org/hibernate/orm/test/inheritance/TransientOverrideAsPersistentJoined.java b/hibernate-core/src/test/java/org/hibernate/orm/test/inheritance/TransientOverrideAsPersistentJoined.java index 5051c943b2..d05b4c3025 100644 --- a/hibernate-core/src/test/java/org/hibernate/orm/test/inheritance/TransientOverrideAsPersistentJoined.java +++ b/hibernate-core/src/test/java/org/hibernate/orm/test/inheritance/TransientOverrideAsPersistentJoined.java @@ -128,7 +128,7 @@ public class TransientOverrideAsPersistentJoined { catch (IllegalArgumentException e) { assertThat( ExceptionHelper.getRootCause( e ).getMessage(), - containsString( "due to the attribute being declared in multiple sub types" ) + containsString( "due to the attribute being declared in multiple subtypes" ) ); } } );