diff --git a/hibernate-core/src/main/java/org/hibernate/binder/internal/TenantIdBinder.java b/hibernate-core/src/main/java/org/hibernate/binder/internal/TenantIdBinder.java index 9b02947928..4d7254ec80 100644 --- a/hibernate-core/src/main/java/org/hibernate/binder/internal/TenantIdBinder.java +++ b/hibernate-core/src/main/java/org/hibernate/binder/internal/TenantIdBinder.java @@ -66,9 +66,9 @@ public class TenantIdBinder implements AttributeBinder { if ( !parameterJtd.getJavaTypeClass().equals( tenantIdTypeJtd.getJavaTypeClass() ) ) { throw new MappingException( "all @TenantId fields must have the same type: " - + parameterJtd.getJavaType().getTypeName() + + parameterJtd.getTypeName() + " differs from " - + tenantIdTypeJtd.getJavaType().getTypeName() + + tenantIdTypeJtd.getTypeName() ); } } diff --git a/hibernate-core/src/main/java/org/hibernate/boot/model/TypeDefinitionRegistryStandardImpl.java b/hibernate-core/src/main/java/org/hibernate/boot/model/TypeDefinitionRegistryStandardImpl.java index fc1bb08fa0..9261f9467a 100644 --- a/hibernate-core/src/main/java/org/hibernate/boot/model/TypeDefinitionRegistryStandardImpl.java +++ b/hibernate-core/src/main/java/org/hibernate/boot/model/TypeDefinitionRegistryStandardImpl.java @@ -57,7 +57,7 @@ public class TypeDefinitionRegistryStandardImpl implements TypeDefinitionRegistr return null; } - return typeDefinitionMap.get( jtd.getJavaType().getTypeName() ); + return typeDefinitionMap.get( jtd.getTypeName() ); } @Override diff --git a/hibernate-core/src/main/java/org/hibernate/boot/model/internal/AnnotationBinder.java b/hibernate-core/src/main/java/org/hibernate/boot/model/internal/AnnotationBinder.java index 901ec04502..41bdd5a2b6 100644 --- a/hibernate-core/src/main/java/org/hibernate/boot/model/internal/AnnotationBinder.java +++ b/hibernate-core/src/main/java/org/hibernate/boot/model/internal/AnnotationBinder.java @@ -782,11 +782,11 @@ public final class AnnotationBinder { new JpaAttributeConverterImpl( bean, converterJtd, domainJtd, relationalJtd ); return new ConvertedBasicTypeImpl<>( ConverterDescriptor.TYPE_NAME_PREFIX - + valueConverter.getConverterJavaType().getJavaType().getTypeName(), + + valueConverter.getConverterJavaType().getTypeName(), String.format( "BasicType adapter for AttributeConverter<%s,%s>", - domainJtd.getJavaType().getTypeName(), - relationalJtd.getJavaType().getTypeName() + domainJtd.getTypeName(), + relationalJtd.getTypeName() ), relationalJtd.getRecommendedJdbcType( typeConfiguration.getCurrentBaseSqlTypeIndicators() ), valueConverter diff --git a/hibernate-core/src/main/java/org/hibernate/boot/model/process/internal/NamedConverterResolution.java b/hibernate-core/src/main/java/org/hibernate/boot/model/process/internal/NamedConverterResolution.java index 3eff73136f..a2827ae772 100644 --- a/hibernate-core/src/main/java/org/hibernate/boot/model/process/internal/NamedConverterResolution.java +++ b/hibernate-core/src/main/java/org/hibernate/boot/model/process/internal/NamedConverterResolution.java @@ -200,11 +200,11 @@ public class NamedConverterResolution implements BasicValue.Resolution { this.legacyResolvedType = new CustomMutabilityConvertedBasicTypeImpl<>( ConverterDescriptor.TYPE_NAME_PREFIX - + valueConverter.getConverterJavaType().getJavaType().getTypeName(), + + valueConverter.getConverterJavaType().getTypeName(), String.format( "BasicType adapter for AttributeConverter<%s,%s>", - domainJtd.getJavaType().getTypeName(), - relationalJtd.getJavaType().getTypeName() + domainJtd.getTypeName(), + relationalJtd.getTypeName() ), jdbcType, valueConverter, diff --git a/hibernate-core/src/main/java/org/hibernate/id/UUIDGenerator.java b/hibernate-core/src/main/java/org/hibernate/id/UUIDGenerator.java index 7dd85ca61e..c5e7297a0c 100644 --- a/hibernate-core/src/main/java/org/hibernate/id/UUIDGenerator.java +++ b/hibernate-core/src/main/java/org/hibernate/id/UUIDGenerator.java @@ -91,7 +91,7 @@ public class UUIDGenerator implements IdentifierGenerator, StandardGenerator { valueTransformer = UUIDJavaType.ToBytesTransformer.INSTANCE; } else { - throw new HibernateException( "Unanticipated return type [" + type.getReturnedClass().getName() + "] for UUID conversion" ); + throw new HibernateException( "Unanticipated return type [" + type.getReturnedClassName() + "] for UUID conversion" ); } } diff --git a/hibernate-core/src/main/java/org/hibernate/mapping/SimpleValue.java b/hibernate-core/src/main/java/org/hibernate/mapping/SimpleValue.java index 04a89fb624..bd6941e58c 100644 --- a/hibernate-core/src/main/java/org/hibernate/mapping/SimpleValue.java +++ b/hibernate-core/src/main/java/org/hibernate/mapping/SimpleValue.java @@ -772,11 +772,11 @@ public abstract class SimpleValue implements KeyValue { // todo : cache the AttributeConverterTypeAdapter in case that AttributeConverter is applied multiple times. return new ConvertedBasicTypeImpl<>( TYPE_NAME_PREFIX - + jpaAttributeConverter.getConverterJavaType().getJavaType().getTypeName(), + + jpaAttributeConverter.getConverterJavaType().getTypeName(), String.format( "BasicType adapter for AttributeConverter<%s,%s>", - domainJavaType.getJavaType().getTypeName(), - relationalJavaType.getJavaType().getTypeName() + domainJavaType.getTypeName(), + relationalJavaType.getTypeName() ), metadata.getTypeConfiguration().getJdbcTypeRegistry().getDescriptor( jdbcTypeCode ), jpaAttributeConverter diff --git a/hibernate-core/src/main/java/org/hibernate/metamodel/internal/EmbeddableRepresentationStrategyPojo.java b/hibernate-core/src/main/java/org/hibernate/metamodel/internal/EmbeddableRepresentationStrategyPojo.java index 35b309e6c4..7a361cdb39 100644 --- a/hibernate-core/src/main/java/org/hibernate/metamodel/internal/EmbeddableRepresentationStrategyPojo.java +++ b/hibernate-core/src/main/java/org/hibernate/metamodel/internal/EmbeddableRepresentationStrategyPojo.java @@ -153,7 +153,7 @@ public class EmbeddableRepresentationStrategyPojo extends AbstractEmbeddableRepr String.format( Locale.ROOT, "Could not resolve PropertyAccess for attribute `%s#%s`", - getEmbeddableJavaType().getJavaType().getTypeName(), + getEmbeddableJavaType().getTypeName(), bootAttributeDescriptor.getName() ) ); diff --git a/hibernate-core/src/main/java/org/hibernate/metamodel/internal/EntityRepresentationStrategyPojoStandard.java b/hibernate-core/src/main/java/org/hibernate/metamodel/internal/EntityRepresentationStrategyPojoStandard.java index b825b32fd3..fbd277a332 100644 --- a/hibernate-core/src/main/java/org/hibernate/metamodel/internal/EntityRepresentationStrategyPojoStandard.java +++ b/hibernate-core/src/main/java/org/hibernate/metamodel/internal/EntityRepresentationStrategyPojoStandard.java @@ -330,7 +330,7 @@ public class EntityRepresentationStrategyPojoStandard implements EntityRepresent String.format( Locale.ROOT, "Could not resolve PropertyAccess for attribute `%s#%s`", - mappedJtd.getJavaType().getTypeName(), + mappedJtd.getTypeName(), bootAttributeDescriptor.getName() ) ); diff --git a/hibernate-core/src/main/java/org/hibernate/metamodel/mapping/internal/SimpleNaturalIdMapping.java b/hibernate-core/src/main/java/org/hibernate/metamodel/mapping/internal/SimpleNaturalIdMapping.java index 50bd0e9d8d..fe6a5b258e 100644 --- a/hibernate-core/src/main/java/org/hibernate/metamodel/mapping/internal/SimpleNaturalIdMapping.java +++ b/hibernate-core/src/main/java/org/hibernate/metamodel/mapping/internal/SimpleNaturalIdMapping.java @@ -141,7 +141,7 @@ public class SimpleNaturalIdMapping extends AbstractNaturalIdMapping implements "Incoming natural-id value [%s (`%s`)] is not of expected type [`%s`] and could not be coerced", naturalIdValue, naturalIdValueClass.getName(), - getJavaType().getJavaType().getTypeName() + getJavaType().getTypeName() ) ); } diff --git a/hibernate-core/src/main/java/org/hibernate/metamodel/mapping/internal/ToOneAttributeMapping.java b/hibernate-core/src/main/java/org/hibernate/metamodel/mapping/internal/ToOneAttributeMapping.java index 19e47dac72..93275d2859 100644 --- a/hibernate-core/src/main/java/org/hibernate/metamodel/mapping/internal/ToOneAttributeMapping.java +++ b/hibernate-core/src/main/java/org/hibernate/metamodel/mapping/internal/ToOneAttributeMapping.java @@ -592,7 +592,7 @@ public class ToOneAttributeMapping final Collection collection = (Collection) value; if ( propertyPath.equals( collection.getMappedByProperty() ) && collection.getElement().getType().getName() - .equals( declaringType.getJavaType().getJavaType().getTypeName() ) ) { + .equals( declaringType.getJavaType().getTypeName() ) ) { return parentSelectablePath == null ? SelectablePath.parse( property.getName() ) : parentSelectablePath.append( property.getName() ); @@ -627,7 +627,7 @@ public class ToOneAttributeMapping if (declaringTableGroupProducer.getNavigableRole().getLocalName().equals( oneToOne.getReferencedEntityName() ) && propertyPath.equals( oneToOne.getMappedByProperty() ) && oneToOne.getReferencedEntityName() - .equals( declaringType.getJavaType().getJavaType().getTypeName() ) ) { + .equals( declaringType.getJavaType().getTypeName() ) ) { return parentSelectablePath == null ? SelectablePath.parse( property.getName() ) : parentSelectablePath.append( property.getName() ); @@ -1466,13 +1466,13 @@ public class ToOneAttributeMapping where leve2Child is of type DerivedLevel2 while level2Parent of type Level2 - for this reason we need the check entityMappingType.isSubclassEntityName( partMappingType.getMappedJavaType().getJavaType().getTypeName() ) + for this reason we need the check entityMappingType.isSubclassEntityName( partMappingType.getMappedJavaType().getTypeName() ) to be sure that the referencedNavigablePath corresponds to leve2Child */ while ( !( partMappingType instanceof EntityMappingType ) || ( partMappingType != entityMappingType - && !entityMappingType.getEntityPersister().isSubclassEntityName( partMappingType.getMappedJavaType().getJavaType().getTypeName() ) + && !entityMappingType.getEntityPersister().isSubclassEntityName( partMappingType.getMappedJavaType().getTypeName() ) && !( (EntityMappingType) partMappingType ).getEntityPersister().isSubclassEntityName( entityMappingType.getEntityName() ) ) ) { referencedNavigablePath = referencedNavigablePath.getParent(); if ( referencedNavigablePath == null ) { diff --git a/hibernate-core/src/main/java/org/hibernate/metamodel/model/domain/internal/EmbeddableTypeImpl.java b/hibernate-core/src/main/java/org/hibernate/metamodel/model/domain/internal/EmbeddableTypeImpl.java index 9770582ede..21b746cce4 100644 --- a/hibernate-core/src/main/java/org/hibernate/metamodel/model/domain/internal/EmbeddableTypeImpl.java +++ b/hibernate-core/src/main/java/org/hibernate/metamodel/model/domain/internal/EmbeddableTypeImpl.java @@ -15,7 +15,6 @@ import org.hibernate.metamodel.model.domain.spi.JpaMetamodelImplementor; import org.hibernate.type.descriptor.java.JavaType; import jakarta.persistence.metamodel.SingularAttribute; -import jakarta.persistence.metamodel.Type; /** * Implementation of {@link jakarta.persistence.metamodel.EmbeddableType}. @@ -33,7 +32,7 @@ public class EmbeddableTypeImpl JavaType javaType, boolean isDynamic, JpaMetamodelImplementor domainMetamodel) { - super( javaType.getJavaType().getTypeName(), javaType, null, domainMetamodel ); + super( javaType.getTypeName(), javaType, null, domainMetamodel ); this.isDynamic = isDynamic; } 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 c86de0c23d..b9266c6d59 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 @@ -51,7 +51,7 @@ public class MappedSuperclassTypeImpl extends AbstractIdentifiableType imp IdentifiableDomainType superType, JpaMetamodelImplementor jpaMetamodel) { this( - javaType.getJavaType().getTypeName(), + javaType.getTypeName(), mappedSuperclass.getDeclaredIdentifierMapper() != null || superType != null && superType.hasIdClass(), mappedSuperclass.hasIdentifierProperty(), 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 3d2fbc4151..23f977cde6 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 @@ -6087,15 +6087,11 @@ public abstract class AbstractEntityPersister Locale.ROOT, "Could not resolve attribute '%s' of '%s' due to the attribute being declared in multiple subtypes '%s' and '%s'", name, - getJavaType().getJavaType().getTypeName(), + getJavaType().getTypeName(), attribute.asAttributeMapping().getDeclaringType() - .getJavaType() - .getJavaType() - .getTypeName(), + .getJavaType().getTypeName(), subDefinedAttribute.asAttributeMapping().getDeclaringType() - .getJavaType() - .getJavaType() - .getTypeName() + .getJavaType().getTypeName() ) ); } diff --git a/hibernate-core/src/main/java/org/hibernate/query/sqm/internal/QuerySqmImpl.java b/hibernate-core/src/main/java/org/hibernate/query/sqm/internal/QuerySqmImpl.java index aa9076b041..be67ee0a19 100644 --- a/hibernate-core/src/main/java/org/hibernate/query/sqm/internal/QuerySqmImpl.java +++ b/hibernate-core/src/main/java/org/hibernate/query/sqm/internal/QuerySqmImpl.java @@ -405,8 +405,8 @@ public class QuerySqmImpl // throw new SemanticException( // String.format( // "Expected insert attribute type [%s] did not match Query selection type [%s] at selection index [%d]", -// insertionTargetPaths.get( i ).getJavaTypeDescriptor().getJavaType().getTypeName(), -// expression.getNodeJavaType().getJavaType().getTypeName(), +// insertionTargetPaths.get( i ).getJavaTypeDescriptor().getTypeName(), +// expression.getNodeJavaType().getTypeName(), // i // ), // hqlString, diff --git a/hibernate-core/src/main/java/org/hibernate/query/sqm/tree/domain/SqmPolymorphicRootDescriptor.java b/hibernate-core/src/main/java/org/hibernate/query/sqm/tree/domain/SqmPolymorphicRootDescriptor.java index 2d0f750c37..862802fc7d 100644 --- a/hibernate-core/src/main/java/org/hibernate/query/sqm/tree/domain/SqmPolymorphicRootDescriptor.java +++ b/hibernate-core/src/main/java/org/hibernate/query/sqm/tree/domain/SqmPolymorphicRootDescriptor.java @@ -117,7 +117,7 @@ public class SqmPolymorphicRootDescriptor implements EntityDomainType { @Override public String getName() { - return polymorphicJavaType.getJavaType().getTypeName(); + return polymorphicJavaType.getTypeName(); } @Override diff --git a/hibernate-core/src/main/java/org/hibernate/query/sqm/tree/expression/SqmEnumLiteral.java b/hibernate-core/src/main/java/org/hibernate/query/sqm/tree/expression/SqmEnumLiteral.java index c47dd99b64..cd8b4b6c6a 100644 --- a/hibernate-core/src/main/java/org/hibernate/query/sqm/tree/expression/SqmEnumLiteral.java +++ b/hibernate-core/src/main/java/org/hibernate/query/sqm/tree/expression/SqmEnumLiteral.java @@ -100,7 +100,7 @@ public class SqmEnumLiteral> extends SqmLiteral implements String.format( Locale.ROOT, "Static enum reference [%s#%s] cannot be de-referenced", - referencedEnumTypeDescriptor.getJavaType().getTypeName(), + referencedEnumTypeDescriptor.getTypeName(), enumValueName ) ); @@ -115,7 +115,7 @@ public class SqmEnumLiteral> extends SqmLiteral implements String.format( Locale.ROOT, "Static enum reference [%s#%s] cannot be de-referenced", - referencedEnumTypeDescriptor.getJavaType().getTypeName(), + referencedEnumTypeDescriptor.getTypeName(), enumValueName ) ); diff --git a/hibernate-core/src/main/java/org/hibernate/query/sqm/tree/expression/SqmFieldLiteral.java b/hibernate-core/src/main/java/org/hibernate/query/sqm/tree/expression/SqmFieldLiteral.java index 1076006b37..5d607d7524 100644 --- a/hibernate-core/src/main/java/org/hibernate/query/sqm/tree/expression/SqmFieldLiteral.java +++ b/hibernate-core/src/main/java/org/hibernate/query/sqm/tree/expression/SqmFieldLiteral.java @@ -243,7 +243,7 @@ public class SqmFieldLiteral implements SqmExpression, SqmExpressible, String.format( Locale.ROOT, "Static field reference [%s#%s] cannot be de-referenced", - fieldJavaType.getJavaType().getTypeName(), + fieldJavaType.getTypeName(), fieldName ) ); @@ -258,7 +258,7 @@ public class SqmFieldLiteral implements SqmExpression, SqmExpressible, String.format( Locale.ROOT, "Static field reference [%s#%s] cannot be de-referenced", - fieldJavaType.getJavaType().getTypeName(), + fieldJavaType.getTypeName(), fieldName ) ); diff --git a/hibernate-core/src/main/java/org/hibernate/sql/results/graph/basic/BasicResultAssembler.java b/hibernate-core/src/main/java/org/hibernate/sql/results/graph/basic/BasicResultAssembler.java index 51ec44a169..bda3134d26 100644 --- a/hibernate-core/src/main/java/org/hibernate/sql/results/graph/basic/BasicResultAssembler.java +++ b/hibernate-core/src/main/java/org/hibernate/sql/results/graph/basic/BasicResultAssembler.java @@ -68,7 +68,7 @@ public class BasicResultAssembler implements DomainResultAssembler { String.format( Locale.ROOT, "Expecting raw JDBC value of type `%s`, but found `%s` : [%s]", - valueConverter.getRelationalJavaType().getJavaType().getTypeName(), + valueConverter.getRelationalJavaType().getTypeName(), jdbcValue.getClass().getName(), jdbcValue ) diff --git a/hibernate-core/src/main/java/org/hibernate/sql/results/graph/instantiation/internal/DynamicInstantiation.java b/hibernate-core/src/main/java/org/hibernate/sql/results/graph/instantiation/internal/DynamicInstantiation.java index 2f6e6d8a26..d8ce0a3165 100644 --- a/hibernate-core/src/main/java/org/hibernate/sql/results/graph/instantiation/internal/DynamicInstantiation.java +++ b/hibernate-core/src/main/java/org/hibernate/sql/results/graph/instantiation/internal/DynamicInstantiation.java @@ -90,7 +90,7 @@ public class DynamicInstantiation implements DomainResultProducer { @Override public String toString() { - return "DynamicInstantiation(" + getTargetJavaType().getJavaType().getTypeName() + ")"; + return "DynamicInstantiation(" + getTargetJavaType().getTypeName() + ")"; } @Override diff --git a/hibernate-core/src/main/java/org/hibernate/sql/results/graph/instantiation/internal/DynamicInstantiationAssemblerInjectionImpl.java b/hibernate-core/src/main/java/org/hibernate/sql/results/graph/instantiation/internal/DynamicInstantiationAssemblerInjectionImpl.java index 19ee0ca57a..eb215cfc31 100644 --- a/hibernate-core/src/main/java/org/hibernate/sql/results/graph/instantiation/internal/DynamicInstantiationAssemblerInjectionImpl.java +++ b/hibernate-core/src/main/java/org/hibernate/sql/results/graph/instantiation/internal/DynamicInstantiationAssemblerInjectionImpl.java @@ -94,7 +94,7 @@ public class DynamicInstantiationAssemblerInjectionImpl implements DomainResu catch ( NoSuchMethodException | IllegalAccessException | InvocationTargetException | InstantiationException | java.lang.InstantiationException e ) { throw new InstantiationException( "Error instantiating class '" - + target.getJavaType().getTypeName() + "' using default constructor: " + e.getMessage(), e ); + + target.getTypeName() + "' using default constructor: " + e.getMessage(), e ); } for ( BeanInjection beanInjection : beanInjections ) { final Object assembled = beanInjection.getValueAssembler().assemble( rowProcessingState, options ); diff --git a/hibernate-core/src/main/java/org/hibernate/sql/results/graph/instantiation/internal/DynamicInstantiationResultImpl.java b/hibernate-core/src/main/java/org/hibernate/sql/results/graph/instantiation/internal/DynamicInstantiationResultImpl.java index b8e0406740..1fc1017dec 100644 --- a/hibernate-core/src/main/java/org/hibernate/sql/results/graph/instantiation/internal/DynamicInstantiationResultImpl.java +++ b/hibernate-core/src/main/java/org/hibernate/sql/results/graph/instantiation/internal/DynamicInstantiationResultImpl.java @@ -180,20 +180,20 @@ public class DynamicInstantiationResultImpl implements DynamicInstantiationRe if ( log.isDebugEnabled() ) { log.debugf( "Could not locate appropriate constructor for dynamic instantiation of [%s]; attempting bean-injection instantiation", - javaType.getJavaType().getTypeName() + javaType.getTypeName() ); } if ( !areAllArgumentsAliased) { throw new IllegalStateException( - "Cannot instantiate class '" + javaType.getJavaType().getTypeName() + "'" + "Cannot instantiate class '" + javaType.getTypeName() + "'" + " (it has no constructor with signature " + signature() + ", and not every argument has an alias)" ); } if ( !duplicatedAliases.isEmpty() ) { throw new IllegalStateException( - "Cannot instantiate class '" + javaType.getJavaType().getTypeName() + "'" + "Cannot instantiate class '" + javaType.getTypeName() + "'" + " (it has no constructor with signature " + signature() + ", and has arguments with duplicate aliases [" + StringHelper.join( ",", duplicatedAliases) + "])" @@ -205,7 +205,7 @@ public class DynamicInstantiationResultImpl implements DynamicInstantiationRe private List signature() { return argumentResults.stream() - .map( adt -> adt.getResultJavaType().getJavaType().getTypeName() ) + .map( adt -> adt.getResultJavaType().getTypeName() ) .collect( toList() ); } } diff --git a/hibernate-core/src/main/java/org/hibernate/type/AbstractStandardBasicType.java b/hibernate-core/src/main/java/org/hibernate/type/AbstractStandardBasicType.java index a95a293e74..592c070900 100644 --- a/hibernate-core/src/main/java/org/hibernate/type/AbstractStandardBasicType.java +++ b/hibernate-core/src/main/java/org/hibernate/type/AbstractStandardBasicType.java @@ -119,7 +119,7 @@ public abstract class AbstractStandardBasicType @Override public String[] getRegistrationKeys() { return registerUnderJavaType() - ? new String[] { getName(), javaType.getJavaType().getTypeName() } + ? new String[] { getName(), javaType.getTypeName() } : new String[] { getName() }; } diff --git a/hibernate-core/src/main/java/org/hibernate/type/CollectionType.java b/hibernate-core/src/main/java/org/hibernate/type/CollectionType.java index 146bdb5a64..34be9bee91 100644 --- a/hibernate-core/src/main/java/org/hibernate/type/CollectionType.java +++ b/hibernate-core/src/main/java/org/hibernate/type/CollectionType.java @@ -217,7 +217,7 @@ public abstract class CollectionType extends AbstractType implements Association @Override public String getName() { - return getReturnedClass().getName() + '(' + getRole() + ')'; + return getReturnedClassName() + '(' + getRole() + ')'; } /** 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 540d7bd6e9..37ac9dd9c9 100644 --- a/hibernate-core/src/main/java/org/hibernate/type/ComponentType.java +++ b/hibernate-core/src/main/java/org/hibernate/type/ComponentType.java @@ -663,7 +663,7 @@ public class ComponentType extends AbstractType implements CompositeTypeImplemen } } throw new PropertyNotFoundException( - "Could not resolve attribute '" + name + "' of '" + getReturnedClass().getName() + "'" + "Could not resolve attribute '" + name + "' of '" + getReturnedClassName() + "'" + " (must be one of '" + StringHelper.join("', '", names) + "')" ); } diff --git a/hibernate-core/src/main/java/org/hibernate/type/SerializableToBlobType.java b/hibernate-core/src/main/java/org/hibernate/type/SerializableToBlobType.java index 344e628b55..017aca17b2 100644 --- a/hibernate-core/src/main/java/org/hibernate/type/SerializableToBlobType.java +++ b/hibernate-core/src/main/java/org/hibernate/type/SerializableToBlobType.java @@ -133,7 +133,7 @@ public class SerializableToBlobType implements BasicType @Override public String[] getRegistrationKeys() { return registerUnderJavaType() - ? new String[] { getName(), javaType.getJavaType().getTypeName() } + ? new String[] { getName(), javaType.getTypeName() } : new String[] { getName() }; } diff --git a/hibernate-core/src/main/java/org/hibernate/type/StandardBasicTypeTemplate.java b/hibernate-core/src/main/java/org/hibernate/type/StandardBasicTypeTemplate.java index 9dad11ae53..e9fa586012 100644 --- a/hibernate-core/src/main/java/org/hibernate/type/StandardBasicTypeTemplate.java +++ b/hibernate-core/src/main/java/org/hibernate/type/StandardBasicTypeTemplate.java @@ -28,7 +28,7 @@ public class StandardBasicTypeTemplate extends AbstractSingleColumnStandardBa super( jdbcType, javaType ); this.registrationKeys = registrationKeys; - this.name = javaType.getJavaType() == null ? "(map-mode)" : javaType.getJavaType().getTypeName() + this.name = javaType.getJavaType() == null ? "(map-mode)" : javaType.getTypeName() + " -> " + jdbcType.getDefaultSqlTypeCode(); } diff --git a/hibernate-core/src/main/java/org/hibernate/type/Type.java b/hibernate-core/src/main/java/org/hibernate/type/Type.java index f52d6a1bba..4d85ac95b2 100644 --- a/hibernate-core/src/main/java/org/hibernate/type/Type.java +++ b/hibernate-core/src/main/java/org/hibernate/type/Type.java @@ -123,10 +123,21 @@ public interface Type extends Serializable { /** * The class handled by this type. * - * @return The java type class handled by this type. + * @return The Java class handled by this type. */ Class getReturnedClass(); + /** + * The qualified name of the class handled by this type. + * + * @return The qualified Java class name. + * + * @since 6.5 + */ + default String getReturnedClassName() { + return getReturnedClass().getName(); + } + /** * Compare two instances of the class mapped by this type for persistence "equality", * that is, equality of persistent state, taking a shortcut for entity references. diff --git a/hibernate-core/src/main/java/org/hibernate/type/descriptor/java/AbstractTemporalJavaType.java b/hibernate-core/src/main/java/org/hibernate/type/descriptor/java/AbstractTemporalJavaType.java index 37e3c86578..d6ec8686e7 100644 --- a/hibernate-core/src/main/java/org/hibernate/type/descriptor/java/AbstractTemporalJavaType.java +++ b/hibernate-core/src/main/java/org/hibernate/type/descriptor/java/AbstractTemporalJavaType.java @@ -82,6 +82,6 @@ public abstract class AbstractTemporalJavaType @Override public String toString() { - return "TemporalJavaType(javaType=" + getJavaType().getTypeName() + ")"; + return "TemporalJavaType(javaType=" + getTypeName() + ")"; } } diff --git a/hibernate-core/src/main/java/org/hibernate/type/descriptor/java/BigDecimalJavaType.java b/hibernate-core/src/main/java/org/hibernate/type/descriptor/java/BigDecimalJavaType.java index e2e884001b..f78a4df638 100644 --- a/hibernate-core/src/main/java/org/hibernate/type/descriptor/java/BigDecimalJavaType.java +++ b/hibernate-core/src/main/java/org/hibernate/type/descriptor/java/BigDecimalJavaType.java @@ -101,7 +101,7 @@ public class BigDecimalJavaType extends AbstractClassJavaType { @Override public boolean isWider(JavaType javaType) { - switch ( javaType.getJavaType().getTypeName() ) { + switch ( javaType.getTypeName() ) { case "byte": case "java.lang.Byte": case "short": diff --git a/hibernate-core/src/main/java/org/hibernate/type/descriptor/java/BigIntegerJavaType.java b/hibernate-core/src/main/java/org/hibernate/type/descriptor/java/BigIntegerJavaType.java index ef322105b2..bcba7fa9b1 100644 --- a/hibernate-core/src/main/java/org/hibernate/type/descriptor/java/BigIntegerJavaType.java +++ b/hibernate-core/src/main/java/org/hibernate/type/descriptor/java/BigIntegerJavaType.java @@ -99,7 +99,7 @@ public class BigIntegerJavaType extends AbstractClassJavaType { @Override public boolean isWider(JavaType javaType) { - switch ( javaType.getJavaType().getTypeName() ) { + switch ( javaType.getTypeName() ) { case "byte": case "java.lang.Byte": case "short": diff --git a/hibernate-core/src/main/java/org/hibernate/type/descriptor/java/CalendarDateJavaType.java b/hibernate-core/src/main/java/org/hibernate/type/descriptor/java/CalendarDateJavaType.java index 2570ae9aa5..fb5c8020d3 100644 --- a/hibernate-core/src/main/java/org/hibernate/type/descriptor/java/CalendarDateJavaType.java +++ b/hibernate-core/src/main/java/org/hibernate/type/descriptor/java/CalendarDateJavaType.java @@ -132,7 +132,7 @@ public class CalendarDateJavaType extends AbstractTemporalJavaType { @Override public boolean isWider(JavaType javaType) { - switch ( javaType.getJavaType().getTypeName() ) { + switch ( javaType.getTypeName() ) { case "java.sql.Date": return true; default: diff --git a/hibernate-core/src/main/java/org/hibernate/type/descriptor/java/CalendarJavaType.java b/hibernate-core/src/main/java/org/hibernate/type/descriptor/java/CalendarJavaType.java index bc08140680..af3c986d75 100644 --- a/hibernate-core/src/main/java/org/hibernate/type/descriptor/java/CalendarJavaType.java +++ b/hibernate-core/src/main/java/org/hibernate/type/descriptor/java/CalendarJavaType.java @@ -149,7 +149,7 @@ public class CalendarJavaType extends AbstractTemporalJavaType impleme @Override public boolean isWider(JavaType javaType) { - switch ( javaType.getJavaType().getTypeName() ) { + switch ( javaType.getTypeName() ) { case "java.util.Date": case "java.sql.Date": case "java.sql.Timestamp": diff --git a/hibernate-core/src/main/java/org/hibernate/type/descriptor/java/CalendarTimeJavaType.java b/hibernate-core/src/main/java/org/hibernate/type/descriptor/java/CalendarTimeJavaType.java index 5922b80558..c9ccfca1df 100644 --- a/hibernate-core/src/main/java/org/hibernate/type/descriptor/java/CalendarTimeJavaType.java +++ b/hibernate-core/src/main/java/org/hibernate/type/descriptor/java/CalendarTimeJavaType.java @@ -134,7 +134,7 @@ public class CalendarTimeJavaType extends AbstractTemporalJavaType { @Override public boolean isWider(JavaType javaType) { - switch ( javaType.getJavaType().getTypeName() ) { + switch ( javaType.getTypeName() ) { case "java.sql.Time": return true; default: diff --git a/hibernate-core/src/main/java/org/hibernate/type/descriptor/java/DateJavaType.java b/hibernate-core/src/main/java/org/hibernate/type/descriptor/java/DateJavaType.java index dd0ce09179..72a21df212 100644 --- a/hibernate-core/src/main/java/org/hibernate/type/descriptor/java/DateJavaType.java +++ b/hibernate-core/src/main/java/org/hibernate/type/descriptor/java/DateJavaType.java @@ -169,7 +169,7 @@ public class DateJavaType extends AbstractTemporalJavaType implements Vers @Override public boolean isWider(JavaType javaType) { - switch ( javaType.getJavaType().getTypeName() ) { + switch ( javaType.getTypeName() ) { case "java.sql.Date": case "java.sql.Timestamp": case "java.util.Calendar": diff --git a/hibernate-core/src/main/java/org/hibernate/type/descriptor/java/DoubleJavaType.java b/hibernate-core/src/main/java/org/hibernate/type/descriptor/java/DoubleJavaType.java index b131910428..6171dba2f7 100644 --- a/hibernate-core/src/main/java/org/hibernate/type/descriptor/java/DoubleJavaType.java +++ b/hibernate-core/src/main/java/org/hibernate/type/descriptor/java/DoubleJavaType.java @@ -100,7 +100,7 @@ public class DoubleJavaType extends AbstractClassJavaType implements @Override public boolean isWider(JavaType javaType) { - switch ( javaType.getJavaType().getTypeName() ) { + switch ( javaType.getTypeName() ) { case "byte": case "java.lang.Byte": case "short": diff --git a/hibernate-core/src/main/java/org/hibernate/type/descriptor/java/FloatJavaType.java b/hibernate-core/src/main/java/org/hibernate/type/descriptor/java/FloatJavaType.java index d5cb8d9db6..6078aa5e55 100644 --- a/hibernate-core/src/main/java/org/hibernate/type/descriptor/java/FloatJavaType.java +++ b/hibernate-core/src/main/java/org/hibernate/type/descriptor/java/FloatJavaType.java @@ -99,7 +99,7 @@ public class FloatJavaType extends AbstractClassJavaType implements Primi @Override public boolean isWider(JavaType javaType) { - switch ( javaType.getJavaType().getTypeName() ) { + switch ( javaType.getTypeName() ) { case "byte": case "java.lang.Byte": case "short": diff --git a/hibernate-core/src/main/java/org/hibernate/type/descriptor/java/IntegerJavaType.java b/hibernate-core/src/main/java/org/hibernate/type/descriptor/java/IntegerJavaType.java index 5227d22cf2..ce239f2632 100644 --- a/hibernate-core/src/main/java/org/hibernate/type/descriptor/java/IntegerJavaType.java +++ b/hibernate-core/src/main/java/org/hibernate/type/descriptor/java/IntegerJavaType.java @@ -96,7 +96,7 @@ public class IntegerJavaType extends AbstractClassJavaType @Override public boolean isWider(JavaType javaType) { - switch ( javaType.getJavaType().getTypeName() ) { + switch ( javaType.getTypeName() ) { case "byte": case "java.lang.Byte": case "short": diff --git a/hibernate-core/src/main/java/org/hibernate/type/descriptor/java/JdbcTimestampJavaType.java b/hibernate-core/src/main/java/org/hibernate/type/descriptor/java/JdbcTimestampJavaType.java index 08f49a838c..e0fda9d90e 100644 --- a/hibernate-core/src/main/java/org/hibernate/type/descriptor/java/JdbcTimestampJavaType.java +++ b/hibernate-core/src/main/java/org/hibernate/type/descriptor/java/JdbcTimestampJavaType.java @@ -194,7 +194,7 @@ public class JdbcTimestampJavaType extends AbstractTemporalJavaType implem @Override public boolean isWider(JavaType javaType) { - switch ( javaType.getJavaType().getTypeName() ) { + switch ( javaType.getTypeName() ) { case "java.sql.Date": case "java.sql.Timestamp": case "java.util.Date": diff --git a/hibernate-core/src/main/java/org/hibernate/type/descriptor/java/LocalDateJavaType.java b/hibernate-core/src/main/java/org/hibernate/type/descriptor/java/LocalDateJavaType.java index 6120a2b9f4..370753cd8d 100644 --- a/hibernate-core/src/main/java/org/hibernate/type/descriptor/java/LocalDateJavaType.java +++ b/hibernate-core/src/main/java/org/hibernate/type/descriptor/java/LocalDateJavaType.java @@ -163,7 +163,7 @@ public class LocalDateJavaType extends AbstractTemporalJavaType { @Override public boolean isWider(JavaType javaType) { - switch ( javaType.getJavaType().getTypeName() ) { + switch ( javaType.getTypeName() ) { case "java.sql.Date": return true; default: diff --git a/hibernate-core/src/main/java/org/hibernate/type/descriptor/java/LocalDateTimeJavaType.java b/hibernate-core/src/main/java/org/hibernate/type/descriptor/java/LocalDateTimeJavaType.java index a7469f73e5..504e3ca75e 100644 --- a/hibernate-core/src/main/java/org/hibernate/type/descriptor/java/LocalDateTimeJavaType.java +++ b/hibernate-core/src/main/java/org/hibernate/type/descriptor/java/LocalDateTimeJavaType.java @@ -162,7 +162,7 @@ public class LocalDateTimeJavaType extends AbstractTemporalJavaType javaType) { - switch ( javaType.getJavaType().getTypeName() ) { + switch ( javaType.getTypeName() ) { case "java.sql.Date": case "java.sql.Timestamp": case "java.util.Date": diff --git a/hibernate-core/src/main/java/org/hibernate/type/descriptor/java/LocalTimeJavaType.java b/hibernate-core/src/main/java/org/hibernate/type/descriptor/java/LocalTimeJavaType.java index 68a3f4acf6..df131e06a8 100644 --- a/hibernate-core/src/main/java/org/hibernate/type/descriptor/java/LocalTimeJavaType.java +++ b/hibernate-core/src/main/java/org/hibernate/type/descriptor/java/LocalTimeJavaType.java @@ -169,7 +169,7 @@ public class LocalTimeJavaType extends AbstractTemporalJavaType { @Override public boolean isWider(JavaType javaType) { - switch ( javaType.getJavaType().getTypeName() ) { + switch ( javaType.getTypeName() ) { case "java.sql.Time": return true; default: diff --git a/hibernate-core/src/main/java/org/hibernate/type/descriptor/java/LongJavaType.java b/hibernate-core/src/main/java/org/hibernate/type/descriptor/java/LongJavaType.java index 262cbf1c10..09375859c9 100644 --- a/hibernate-core/src/main/java/org/hibernate/type/descriptor/java/LongJavaType.java +++ b/hibernate-core/src/main/java/org/hibernate/type/descriptor/java/LongJavaType.java @@ -96,7 +96,7 @@ public class LongJavaType extends AbstractClassJavaType @Override public boolean isWider(JavaType javaType) { - switch ( javaType.getJavaType().getTypeName() ) { + switch ( javaType.getTypeName() ) { case "byte": case "java.lang.Byte": case "short": diff --git a/hibernate-core/src/main/java/org/hibernate/type/descriptor/java/ShortJavaType.java b/hibernate-core/src/main/java/org/hibernate/type/descriptor/java/ShortJavaType.java index b0aaa3c0d6..0357ad73c6 100644 --- a/hibernate-core/src/main/java/org/hibernate/type/descriptor/java/ShortJavaType.java +++ b/hibernate-core/src/main/java/org/hibernate/type/descriptor/java/ShortJavaType.java @@ -42,7 +42,7 @@ public class ShortJavaType extends AbstractClassJavaType @Override public boolean isWider(JavaType javaType) { - switch ( javaType.getJavaType().getTypeName() ) { + switch ( javaType.getTypeName() ) { case "byte": case "java.lang.Byte": return true; diff --git a/hibernate-core/src/main/java/org/hibernate/type/descriptor/java/StringJavaType.java b/hibernate-core/src/main/java/org/hibernate/type/descriptor/java/StringJavaType.java index dabeb2bc24..e49cb38184 100644 --- a/hibernate-core/src/main/java/org/hibernate/type/descriptor/java/StringJavaType.java +++ b/hibernate-core/src/main/java/org/hibernate/type/descriptor/java/StringJavaType.java @@ -119,7 +119,7 @@ public class StringJavaType extends AbstractClassJavaType { @Override public boolean isWider(JavaType javaType) { - switch ( javaType.getJavaType().getTypeName() ) { + switch ( javaType.getTypeName() ) { case "char": case "char[]": case "java.lang.Character": diff --git a/hibernate-core/src/main/java/org/hibernate/type/descriptor/java/spi/EmbeddableAggregateJavaType.java b/hibernate-core/src/main/java/org/hibernate/type/descriptor/java/spi/EmbeddableAggregateJavaType.java index 19c1a30f0a..4cb7b3cbee 100644 --- a/hibernate-core/src/main/java/org/hibernate/type/descriptor/java/spi/EmbeddableAggregateJavaType.java +++ b/hibernate-core/src/main/java/org/hibernate/type/descriptor/java/spi/EmbeddableAggregateJavaType.java @@ -42,7 +42,7 @@ public class EmbeddableAggregateJavaType extends AbstractClassJavaType { return descriptor; } throw new JdbcTypeRecommendationException( - "Could not determine recommended JdbcType for `" + getJavaType().getTypeName() + "`" + "Could not determine recommended JdbcType for `" + getTypeName() + "`" ); } @@ -54,7 +54,7 @@ public class EmbeddableAggregateJavaType extends AbstractClassJavaType { @Override public T fromString(CharSequence string) { throw new UnsupportedOperationException( - "Conversion from String strategy not known for this Java type : " + getJavaType().getTypeName() + "Conversion from String strategy not known for this Java type: " + getTypeName() ); } @@ -65,7 +65,7 @@ public class EmbeddableAggregateJavaType extends AbstractClassJavaType { return (X) value; } throw new UnsupportedOperationException( - "Unwrap strategy not known for this Java type : " + getJavaType().getTypeName() + "Unwrap strategy not known for this Java type: " + getTypeName() ); } @@ -76,12 +76,12 @@ public class EmbeddableAggregateJavaType extends AbstractClassJavaType { return (T) value; } throw new UnsupportedOperationException( - "Wrap strategy not known for this Java type : " + getJavaType().getTypeName() + "Wrap strategy not known for this Java type: " + getTypeName() ); } @Override public String toString() { - return "BasicJavaType(" + getJavaType().getTypeName() + ")"; + return "BasicJavaType(" + getTypeName() + ")"; } } diff --git a/hibernate-core/src/main/java/org/hibernate/type/descriptor/java/spi/EntityJavaType.java b/hibernate-core/src/main/java/org/hibernate/type/descriptor/java/spi/EntityJavaType.java index 50445dae38..a75f42ca85 100644 --- a/hibernate-core/src/main/java/org/hibernate/type/descriptor/java/spi/EntityJavaType.java +++ b/hibernate-core/src/main/java/org/hibernate/type/descriptor/java/spi/EntityJavaType.java @@ -30,7 +30,7 @@ public class EntityJavaType extends AbstractClassJavaType { @Override public JdbcType getRecommendedJdbcType(JdbcTypeIndicators context) { throw new JdbcTypeRecommendationException( - "Could not determine recommended JdbcType for `" + getJavaType().getTypeName() + "`" + "Could not determine recommended JdbcType for '" + getTypeName() + "'" ); } @@ -65,26 +65,26 @@ public class EntityJavaType extends AbstractClassJavaType { @Override public T fromString(CharSequence string) { throw new UnsupportedOperationException( - "Conversion from String strategy not known for this Java type : " + getJavaType().getTypeName() + "Conversion from String strategy not known for this Java type: " + getTypeName() ); } @Override public X unwrap(T value, Class type, WrapperOptions options) { throw new UnsupportedOperationException( - "Unwrap strategy not known for this Java type : " + getJavaType().getTypeName() + "Unwrap strategy not known for this Java type: " + getTypeName() ); } @Override public T wrap(X value, WrapperOptions options) { throw new UnsupportedOperationException( - "Wrap strategy not known for this Java type : " + getJavaType().getTypeName() + "Wrap strategy not known for this Java type: " + getTypeName() ); } @Override public String toString() { - return "EntityJavaType(" + getJavaType().getTypeName() + ")"; + return "EntityJavaType(" + getTypeName() + ")"; } } diff --git a/hibernate-core/src/main/java/org/hibernate/type/descriptor/java/spi/FormatMapperBasedJavaType.java b/hibernate-core/src/main/java/org/hibernate/type/descriptor/java/spi/FormatMapperBasedJavaType.java index 3efb550241..dcd6f4039d 100644 --- a/hibernate-core/src/main/java/org/hibernate/type/descriptor/java/spi/FormatMapperBasedJavaType.java +++ b/hibernate-core/src/main/java/org/hibernate/type/descriptor/java/spi/FormatMapperBasedJavaType.java @@ -43,7 +43,7 @@ public abstract class FormatMapperBasedJavaType extends AbstractJavaType i @Override public JdbcType getRecommendedJdbcType(JdbcTypeIndicators context) { throw new JdbcTypeRecommendationException( - "Could not determine recommended JdbcType for Java type '" + getJavaType().getTypeName() + "'" + "Could not determine recommended JdbcType for Java type '" + getTypeName() + "'" ); } @@ -76,7 +76,7 @@ public abstract class FormatMapperBasedJavaType extends AbstractJavaType i return (X) getFormatMapper( typeConfiguration ).toString( value, this, options ); } throw new UnsupportedOperationException( - "Unwrap strategy not known for this Java type : " + getJavaType().getTypeName() + "Unwrap strategy not known for this Java type: " + getTypeName() ); } @@ -90,7 +90,7 @@ public abstract class FormatMapperBasedJavaType extends AbstractJavaType i return getFormatMapper( typeConfiguration ).fromString( (String) value, this, options ); } throw new UnsupportedOperationException( - "Wrap strategy not known for this Java type : " + getJavaType().getTypeName() + "Wrap strategy not known for this Java type: " + getTypeName() ); } diff --git a/hibernate-core/src/main/java/org/hibernate/type/descriptor/java/spi/JavaTypeBasicAdaptor.java b/hibernate-core/src/main/java/org/hibernate/type/descriptor/java/spi/JavaTypeBasicAdaptor.java index 84b458afc9..a1917ac50f 100644 --- a/hibernate-core/src/main/java/org/hibernate/type/descriptor/java/spi/JavaTypeBasicAdaptor.java +++ b/hibernate-core/src/main/java/org/hibernate/type/descriptor/java/spi/JavaTypeBasicAdaptor.java @@ -30,7 +30,7 @@ public class JavaTypeBasicAdaptor extends AbstractClassJavaType { @Override public JdbcType getRecommendedJdbcType(JdbcTypeIndicators context) { throw new JdbcTypeRecommendationException( - "Could not determine recommended JdbcType for `" + getJavaType().getTypeName() + "`" + "Could not determine recommended JdbcType for '" + getTypeName() + "'" ); } @@ -42,26 +42,26 @@ public class JavaTypeBasicAdaptor extends AbstractClassJavaType { @Override public T fromString(CharSequence string) { throw new UnsupportedOperationException( - "Conversion from String strategy not known for this Java type : " + getJavaType().getTypeName() + "Conversion from String strategy not known for this Java type: " + getTypeName() ); } @Override public X unwrap(T value, Class type, WrapperOptions options) { throw new UnsupportedOperationException( - "Unwrap strategy not known for this Java type : " + getJavaType().getTypeName() + "Unwrap strategy not known for this Java type: " + getTypeName() ); } @Override public T wrap(X value, WrapperOptions options) { throw new UnsupportedOperationException( - "Wrap strategy not known for this Java type : " + getJavaType().getTypeName() + "Wrap strategy not known for this Java type: " + getTypeName() ); } @Override public String toString() { - return "JavaTypeBasicAdaptor(" + getJavaType().getTypeName() + ")"; + return "JavaTypeBasicAdaptor(" + getTypeName() + ")"; } } diff --git a/hibernate-core/src/main/java/org/hibernate/type/descriptor/java/spi/JsonJavaType.java b/hibernate-core/src/main/java/org/hibernate/type/descriptor/java/spi/JsonJavaType.java index 1477bcd867..271d35796e 100644 --- a/hibernate-core/src/main/java/org/hibernate/type/descriptor/java/spi/JsonJavaType.java +++ b/hibernate-core/src/main/java/org/hibernate/type/descriptor/java/spi/JsonJavaType.java @@ -38,6 +38,6 @@ public class JsonJavaType extends FormatMapperBasedJavaType { @Override public String toString() { - return "JsonJavaType(" + getJavaType().getTypeName() + ")"; + return "JsonJavaType(" + getTypeName() + ")"; } } diff --git a/hibernate-core/src/main/java/org/hibernate/type/descriptor/java/spi/UnknownBasicJavaType.java b/hibernate-core/src/main/java/org/hibernate/type/descriptor/java/spi/UnknownBasicJavaType.java index 3d5ed2c5df..5dbf6127c3 100644 --- a/hibernate-core/src/main/java/org/hibernate/type/descriptor/java/spi/UnknownBasicJavaType.java +++ b/hibernate-core/src/main/java/org/hibernate/type/descriptor/java/spi/UnknownBasicJavaType.java @@ -19,22 +19,35 @@ import org.hibernate.type.descriptor.jdbc.JdbcTypeIndicators; * {@link org.hibernate.type.descriptor.java.JavaType} for a given Java type. */ public final class UnknownBasicJavaType extends AbstractJavaType { + private final String typeName; + public UnknownBasicJavaType(Class type) { + this( type, type.getTypeName() ); + } + public UnknownBasicJavaType(Class type, String typeName) { super( type ); + this.typeName = typeName; } public UnknownBasicJavaType(Class type, MutabilityPlan mutabilityPlan) { super( type, mutabilityPlan ); + this.typeName = type.getTypeName(); } public UnknownBasicJavaType(Type type, MutabilityPlan mutabilityPlan) { super( type, mutabilityPlan ); + this.typeName = type.getTypeName(); + } + + @Override + public String getTypeName() { + return typeName; } @Override public JdbcType getRecommendedJdbcType(JdbcTypeIndicators context) { throw new JdbcTypeRecommendationException( - "Could not determine recommended JdbcType for Java type '" + getJavaType().getTypeName() + "'" + "Could not determine recommended JdbcType for Java type '" + getTypeName() + "'" ); } @@ -46,7 +59,7 @@ public final class UnknownBasicJavaType extends AbstractJavaType { @Override public T fromString(CharSequence string) { throw new UnsupportedOperationException( - "Conversion from String strategy not known for this Java type : " + getJavaType().getTypeName() + "Conversion from String strategy not known for this Java type: " + getTypeName() ); } @@ -57,7 +70,7 @@ public final class UnknownBasicJavaType extends AbstractJavaType { return (X) value; } throw new UnsupportedOperationException( - "Unwrap strategy not known for this Java type : " + getJavaType().getTypeName() + "Unwrap strategy not known for this Java type: " + getTypeName() ); } @@ -68,12 +81,12 @@ public final class UnknownBasicJavaType extends AbstractJavaType { return (T) value; } throw new UnsupportedOperationException( - "Wrap strategy not known for this Java type : " + getJavaType().getTypeName() + "Wrap strategy not known for this Java type: " + getTypeName() ); } @Override public String toString() { - return "BasicJavaType(" + getJavaType().getTypeName() + ")"; + return "BasicJavaType(" + getTypeName() + ")"; } } diff --git a/hibernate-core/src/main/java/org/hibernate/type/descriptor/java/spi/XmlJavaType.java b/hibernate-core/src/main/java/org/hibernate/type/descriptor/java/spi/XmlJavaType.java index bfbd27b63f..a051dd0cb5 100644 --- a/hibernate-core/src/main/java/org/hibernate/type/descriptor/java/spi/XmlJavaType.java +++ b/hibernate-core/src/main/java/org/hibernate/type/descriptor/java/spi/XmlJavaType.java @@ -38,6 +38,6 @@ public class XmlJavaType extends FormatMapperBasedJavaType { @Override public String toString() { - return "XmlJavaType(" + getJavaType().getTypeName() + ")"; + return "XmlJavaType(" + getTypeName() + ")"; } } diff --git a/tooling/metamodel-generator/src/main/java/org/hibernate/jpamodelgen/validation/MockSessionFactory.java b/tooling/metamodel-generator/src/main/java/org/hibernate/jpamodelgen/validation/MockSessionFactory.java index d185934d74..704ea84696 100644 --- a/tooling/metamodel-generator/src/main/java/org/hibernate/jpamodelgen/validation/MockSessionFactory.java +++ b/tooling/metamodel-generator/src/main/java/org/hibernate/jpamodelgen/validation/MockSessionFactory.java @@ -1061,16 +1061,15 @@ public abstract class MockSessionFactory } } - private EmbeddableTypeImpl createEmbeddableDomainType(String entityName, CompositeType compositeType, ManagedDomainType owner) { - return new EmbeddableTypeImpl(new UnknownBasicJavaType<>(Object.class), true, metamodel.getJpaMetamodel()) { + private EmbeddableTypeImpl createEmbeddableDomainType(String entityName, CompositeType compositeType, ManagedDomainType owner) { + final JavaType javaType = new UnknownBasicJavaType<>(Object.class, compositeType.getReturnedClassName()); + return new EmbeddableTypeImpl<>(javaType, true, metamodel.getJpaMetamodel()) { @Override public PersistentAttribute findAttribute(String name) { - int i = compositeType.getPropertyIndex(name); - Type subtype = compositeType.getSubtypes()[i]; return createAttribute( name, - entityName, //TOOD: WRONG!!! - subtype, + entityName, + compositeType.getSubtypes()[compositeType.getPropertyIndex(name)], owner ); } diff --git a/tooling/metamodel-generator/src/main/java/org/hibernate/jpamodelgen/validation/ProcessorSessionFactory.java b/tooling/metamodel-generator/src/main/java/org/hibernate/jpamodelgen/validation/ProcessorSessionFactory.java index d9e52bba7b..c89e4aead0 100644 --- a/tooling/metamodel-generator/src/main/java/org/hibernate/jpamodelgen/validation/ProcessorSessionFactory.java +++ b/tooling/metamodel-generator/src/main/java/org/hibernate/jpamodelgen/validation/ProcessorSessionFactory.java @@ -264,6 +264,11 @@ public abstract class ProcessorSessionFactory extends MockSessionFactory { return type.getSimpleName().toString(); } + @Override + public String getReturnedClassName() { + return type.getQualifiedName().toString(); + } + @Override public boolean isComponentType() { return true; @@ -803,11 +808,10 @@ public abstract class ProcessorSessionFactory extends MockSessionFactory { // } else if (type instanceof BasicType) { String className; - //sadly there is no way to get the classname - //from a Hibernate Type without trying to load - //the class! + //TODO: custom impl of getReturnedClassName() + // for many more Hibernate types! try { - className = type.getReturnedClass().getName(); + className = type.getReturnedClassName(); } catch (Exception e) { continue; diff --git a/tooling/metamodel-generator/src/test/java/org/hibernate/jpamodelgen/test/hqlsql/Address.java b/tooling/metamodel-generator/src/test/java/org/hibernate/jpamodelgen/test/hqlsql/Address.java new file mode 100644 index 0000000000..00710551d7 --- /dev/null +++ b/tooling/metamodel-generator/src/test/java/org/hibernate/jpamodelgen/test/hqlsql/Address.java @@ -0,0 +1,55 @@ +package org.hibernate.jpamodelgen.test.hqlsql; + +import jakarta.persistence.Embeddable; + +import java.util.Objects; + +@Embeddable +public final class Address { + private String street; + private String city; + private String zip; + + public Address(String street, String city, String zip) { + this.street = street; + this.city = city; + this.zip = zip; + } + + Address() {} + + public String street() { + return street; + } + + public String city() { + return city; + } + + public String zip() { + return zip; + } + + @Override + public boolean equals(Object obj) { + if (obj == this) return true; + if (obj == null || obj.getClass() != this.getClass()) return false; + var that = (Address) obj; + return Objects.equals(this.street, that.street) && + Objects.equals(this.city, that.city) && + Objects.equals(this.zip, that.zip); + } + + @Override + public int hashCode() { + return Objects.hash(street, city, zip); + } + + @Override + public String toString() { + return "Address[" + + "street=" + street + ", " + + "city=" + city + ", " + + "zip=" + zip + ']'; + } +} diff --git a/tooling/metamodel-generator/src/test/java/org/hibernate/jpamodelgen/test/hqlsql/Book.java b/tooling/metamodel-generator/src/test/java/org/hibernate/jpamodelgen/test/hqlsql/Book.java index 68acd83e2b..4fab417fa3 100644 --- a/tooling/metamodel-generator/src/test/java/org/hibernate/jpamodelgen/test/hqlsql/Book.java +++ b/tooling/metamodel-generator/src/test/java/org/hibernate/jpamodelgen/test/hqlsql/Book.java @@ -6,6 +6,7 @@ import jakarta.persistence.ManyToOne; import org.hibernate.annotations.NaturalId; import java.math.BigDecimal; +import java.time.LocalDate; @Entity public class Book { @@ -16,4 +17,5 @@ public class Book { @ManyToOne Publisher publisher; BigDecimal price; int pages; + LocalDate publicationDate; } diff --git a/tooling/metamodel-generator/src/test/java/org/hibernate/jpamodelgen/test/hqlsql/Dao.java b/tooling/metamodel-generator/src/test/java/org/hibernate/jpamodelgen/test/hqlsql/Dao.java index 7d943ed8eb..f7a3342ad8 100644 --- a/tooling/metamodel-generator/src/test/java/org/hibernate/jpamodelgen/test/hqlsql/Dao.java +++ b/tooling/metamodel-generator/src/test/java/org/hibernate/jpamodelgen/test/hqlsql/Dao.java @@ -40,6 +40,9 @@ public interface Dao { @HQL("from Book where isbn = :isbn") Book findByIsbn(String isbn); + @HQL("order by isbn asc, publicationDate desc") + List allBooks(); + @SQL("select * from Book where isbn = :isbn") Book findByIsbnNative(String isbn); @@ -64,4 +67,6 @@ public interface Dao { @HQL("select new list(title, pages) from Book") List dtoQuery4(); + @HQL("from Publisher where address = :address") + List publisherAt(Address address); } diff --git a/tooling/metamodel-generator/src/test/java/org/hibernate/jpamodelgen/test/hqlsql/Publisher.java b/tooling/metamodel-generator/src/test/java/org/hibernate/jpamodelgen/test/hqlsql/Publisher.java index ee97cd1c42..ce94fa8f78 100644 --- a/tooling/metamodel-generator/src/test/java/org/hibernate/jpamodelgen/test/hqlsql/Publisher.java +++ b/tooling/metamodel-generator/src/test/java/org/hibernate/jpamodelgen/test/hqlsql/Publisher.java @@ -7,4 +7,5 @@ import jakarta.persistence.Id; public class Publisher { @Id Long id; String name; -} + Address address; +} \ No newline at end of file