From 71f666f0b6b2dd999377ced61b7b6e863aa79f10 Mon Sep 17 00:00:00 2001 From: Christian Beikov Date: Wed, 5 May 2021 12:00:43 +0200 Subject: [PATCH] Use Property#getPropertyAccessStrategy which internally delegates to BuiltInPropertyAccessStrategies to handle enhanced cases --- .../StandardPojoEmbeddableRepresentationStrategy.java | 10 ++-------- .../StandardPojoEntityRepresentationStrategy.java | 11 ++--------- 2 files changed, 4 insertions(+), 17 deletions(-) diff --git a/hibernate-core/src/main/java/org/hibernate/metamodel/internal/StandardPojoEmbeddableRepresentationStrategy.java b/hibernate-core/src/main/java/org/hibernate/metamodel/internal/StandardPojoEmbeddableRepresentationStrategy.java index 103c269e7f..dcecc0e54a 100644 --- a/hibernate-core/src/main/java/org/hibernate/metamodel/internal/StandardPojoEmbeddableRepresentationStrategy.java +++ b/hibernate-core/src/main/java/org/hibernate/metamodel/internal/StandardPojoEmbeddableRepresentationStrategy.java @@ -83,16 +83,10 @@ public class StandardPojoEmbeddableRepresentationStrategy extends AbstractEmbedd @Override protected PropertyAccess buildPropertyAccess(Property bootAttributeDescriptor) { - PropertyAccessStrategy strategy = null; - final String propertyAccessorName = bootAttributeDescriptor.getPropertyAccessorName(); - final BuiltInPropertyAccessStrategies namedStrategy = BuiltInPropertyAccessStrategies.interpret( - propertyAccessorName ); - if ( namedStrategy != null ) { - strategy = namedStrategy.getStrategy(); - } + PropertyAccessStrategy strategy = bootAttributeDescriptor.getPropertyAccessStrategy( getEmbeddableJavaTypeDescriptor().getJavaTypeClass() ); if ( strategy == null ) { - + final String propertyAccessorName = bootAttributeDescriptor.getPropertyAccessorName(); if ( StringHelper.isNotEmpty( propertyAccessorName ) ) { // handle explicitly specified attribute accessor diff --git a/hibernate-core/src/main/java/org/hibernate/metamodel/internal/StandardPojoEntityRepresentationStrategy.java b/hibernate-core/src/main/java/org/hibernate/metamodel/internal/StandardPojoEntityRepresentationStrategy.java index 5545af6a0b..7adeb00567 100644 --- a/hibernate-core/src/main/java/org/hibernate/metamodel/internal/StandardPojoEntityRepresentationStrategy.java +++ b/hibernate-core/src/main/java/org/hibernate/metamodel/internal/StandardPojoEntityRepresentationStrategy.java @@ -320,17 +320,10 @@ public class StandardPojoEntityRepresentationStrategy implements EntityRepresent } private PropertyAccess makePropertyAccess(Property bootAttributeDescriptor) { - PropertyAccessStrategy strategy = null; - - final String propertyAccessorName = bootAttributeDescriptor.getPropertyAccessorName(); - final BuiltInPropertyAccessStrategies namedStrategy = BuiltInPropertyAccessStrategies.interpret( - propertyAccessorName ); - - if ( namedStrategy != null ) { - strategy = namedStrategy.getStrategy(); - } + PropertyAccessStrategy strategy = bootAttributeDescriptor.getPropertyAccessStrategy( mappedJtd.getJavaTypeClass() ); if ( strategy == null ) { + final String propertyAccessorName = bootAttributeDescriptor.getPropertyAccessorName(); if ( StringHelper.isNotEmpty( propertyAccessorName ) ) { // handle explicitly specified attribute accessor strategy = strategySelector.resolveStrategy( PropertyAccessStrategy.class, propertyAccessorName );