This is an automated email from the ASF dual-hosted git repository.

borinquenkid pushed a commit to branch 8.0.x-hibernate7
in repository https://gitbox.apache.org/repos/asf/grails-core.git

commit a4c20c96ff513046ae3a67768cef48516df92a6d
Author: Walter Duque de Estrada <[email protected]>
AuthorDate: Wed Feb 25 07:50:48 2026 -0600

    cleaning up getTypeName
---
 .../hibernate/GrailsHibernatePersistentProperty.java    |  6 ------
 .../domainbinding/hibernate/HibernateAssociation.java   | 17 +++++++++++++++++
 2 files changed, 17 insertions(+), 6 deletions(-)

diff --git 
a/grails-data-hibernate7/core/src/main/groovy/org/grails/orm/hibernate/cfg/domainbinding/hibernate/GrailsHibernatePersistentProperty.java
 
b/grails-data-hibernate7/core/src/main/groovy/org/grails/orm/hibernate/cfg/domainbinding/hibernate/GrailsHibernatePersistentProperty.java
index 7f1b5f758b..feffc7fd5a 100644
--- 
a/grails-data-hibernate7/core/src/main/groovy/org/grails/orm/hibernate/cfg/domainbinding/hibernate/GrailsHibernatePersistentProperty.java
+++ 
b/grails-data-hibernate7/core/src/main/groovy/org/grails/orm/hibernate/cfg/domainbinding/hibernate/GrailsHibernatePersistentProperty.java
@@ -83,11 +83,6 @@ public interface GrailsHibernatePersistentProperty extends 
PersistentProperty<Pr
    * @return The type name
    */
   default String getTypeName(Class<?> propertyType, PropertyConfig config, 
Mapping mapping) {
-    if (this instanceof Association
-        && propertyType == getType()
-        && getHibernateAssociatedEntity() != null) {
-      return null;
-    }
     String typeName =
         Optional.ofNullable(config)
             .map(PropertyConfig::getType)
@@ -97,7 +92,6 @@ public interface GrailsHibernatePersistentProperty extends 
PersistentProperty<Pr
 
     if (typeName == null
         && propertyType != null
-        && getHibernateAssociatedEntity() == null
         && !propertyType.isEnum()) {
       return propertyType.getName();
     }
diff --git 
a/grails-data-hibernate7/core/src/main/groovy/org/grails/orm/hibernate/cfg/domainbinding/hibernate/HibernateAssociation.java
 
b/grails-data-hibernate7/core/src/main/groovy/org/grails/orm/hibernate/cfg/domainbinding/hibernate/HibernateAssociation.java
index 77bb386634..ef21dbacc6 100644
--- 
a/grails-data-hibernate7/core/src/main/groovy/org/grails/orm/hibernate/cfg/domainbinding/hibernate/HibernateAssociation.java
+++ 
b/grails-data-hibernate7/core/src/main/groovy/org/grails/orm/hibernate/cfg/domainbinding/hibernate/HibernateAssociation.java
@@ -19,9 +19,13 @@
 package org.grails.orm.hibernate.cfg.domainbinding.hibernate;
 
 import java.util.List;
+
 import org.hibernate.mapping.ManyToOne;
 import org.hibernate.mapping.Property;
 
+import org.grails.orm.hibernate.cfg.Mapping;
+import org.grails.orm.hibernate.cfg.PropertyConfig;
+
 /**
  * Common interface for all Hibernate association properties (both ToOne and 
ToMany). Extends
  * {@link GrailsHibernatePersistentProperty} and declares the key {@link
@@ -68,4 +72,17 @@ public interface HibernateAssociation extends 
GrailsHibernatePersistentProperty
         && prop != null
         && prop.getValue() instanceof ManyToOne;
   }
+
+  /**
+   * @param propertyType The property type
+   * @param config The property config
+   * @param mapping The mapping
+   * @return The type name
+   */
+  default String getTypeName(Class<?> propertyType, PropertyConfig config, 
Mapping mapping) {
+    if (propertyType == getType() && getHibernateAssociatedEntity() != null) {
+      return null;
+    }
+    return GrailsHibernatePersistentProperty.super.getTypeName(propertyType, 
config, mapping);
+  }
 }

Reply via email to