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 c2bfe1b3ae83e89eed057f04c2afb716e716d642
Author: Walter Duque de Estrada <[email protected]>
AuthorDate: Tue Feb 10 07:53:56 2026 -0600

    Changes made:
    
       1. `ColumnBinder.java`:
           * Updated the signature of bindColumn to:
    
       1         public void bindColumn(GrailsHibernatePersistentProperty 
property, GrailsHibernatePersistentProperty parentProperty, Column column, 
ColumnConfig cc, String path, Table table)
           * Removed explicit casts to GrailsHibernatePersistentProperty within 
the method body as they are now redundant.
    
       2. `SimpleValueBinder.java`:
           * Updated the call to columnBinder.bindColumn to explicitly cast 
property and parentProperty to GrailsHibernatePersistentProperty.
    
       3. `ColumnBinderSpec.groovy`:
           * Updated parentProp mocks to use GrailsHibernatePersistentProperty 
instead of PersistentProperty to match the new method signature.
    
       4. `SimpleValueBinderSpec.groovy`:
           * Updated the parent property mock to use 
GrailsHibernatePersistentProperty.
---
 .../orm/hibernate/cfg/GrailsDomainBinder.java      | 39 ++++++++++++----------
 .../cfg/GrailsHibernatePersistentEntity.java       |  1 +
 .../cfg/GrailsHibernatePersistentProperty.java     |  2 ++
 .../hibernate/cfg/domainbinding/ColumnBinder.java  | 10 +++---
 .../cfg/domainbinding/GrailsPropertyBinder.java    |  6 ++--
 .../cfg/domainbinding/SimpleValueBinder.java       |  2 +-
 .../cfg/domainbinding/ColumnBinderSpec.groovy      |  8 ++---
 .../ComponentPropertyBinderSpec.groovy             | 10 +++---
 .../cfg/domainbinding/SimpleValueBinderSpec.groovy |  2 +-
 9 files changed, 43 insertions(+), 37 deletions(-)

diff --git 
a/grails-data-hibernate7/core/src/main/groovy/org/grails/orm/hibernate/cfg/GrailsDomainBinder.java
 
b/grails-data-hibernate7/core/src/main/groovy/org/grails/orm/hibernate/cfg/GrailsDomainBinder.java
index cef01a3a9a..c03dfc4317 100644
--- 
a/grails-data-hibernate7/core/src/main/groovy/org/grails/orm/hibernate/cfg/GrailsDomainBinder.java
+++ 
b/grails-data-hibernate7/core/src/main/groovy/org/grails/orm/hibernate/cfg/GrailsDomainBinder.java
@@ -16,8 +16,6 @@ package org.grails.orm.hibernate.cfg;
 
 import groovy.lang.Closure;
 
-import org.grails.datastore.mapping.core.connections.ConnectionSource;
-import org.grails.datastore.mapping.model.PersistentEntity;
 import org.grails.datastore.mapping.model.PersistentProperty;
 import org.grails.datastore.mapping.model.config.GormProperties;
 import org.grails.datastore.mapping.model.types.TenantId;
@@ -44,7 +42,6 @@ import org.hibernate.boot.spi.MetadataBuildingContext;
 import org.hibernate.engine.jdbc.env.spi.JdbcEnvironment;
 import org.hibernate.engine.spi.FilterDefinition;
 import org.hibernate.mapping.BasicValue;
-import org.hibernate.mapping.Collection;
 import org.hibernate.mapping.Column;
 import org.hibernate.mapping.Component;
 import org.hibernate.mapping.DependantValue;
@@ -116,6 +113,9 @@ public class GrailsDomainBinder
     private CollectionHolder collectionHolder;
     private GrailsPropertyBinder grailsPropertyBinder;
     private CollectionBinder collectionBinder;
+    private CompositeIdBinder compositeIdBinder;
+    private IdentityBinder identityBinder;
+    private VersionBinder versionBinder;
 
 
     public JdbcEnvironment getJdbcEnvironment() {
@@ -173,6 +173,9 @@ public class GrailsDomainBinder
         this.collectionBinder = new CollectionBinder(metadataBuildingContext, 
this, getNamingStrategy());
         this.componentPropertyBinder = new 
ComponentPropertyBinder(metadataBuildingContext, getNamingStrategy(), 
getMappingCacheHolder(), getCollectionHolder(), enumTypeBinder, 
collectionBinder, propertyFromValueCreator);
         this.grailsPropertyBinder = new 
GrailsPropertyBinder(metadataBuildingContext, getNamingStrategy(), 
getCollectionHolder(), enumTypeBinder, componentPropertyBinder, 
collectionBinder, propertyFromValueCreator);
+        this.compositeIdBinder = new 
CompositeIdBinder(metadataBuildingContext, componentPropertyBinder);
+        this.identityBinder = new IdentityBinder(metadataBuildingContext, 
getNamingStrategy(), getJdbcEnvironment(), compositeIdBinder);
+        this.versionBinder = new VersionBinder(metadataBuildingContext, 
getNamingStrategy());
 
         hibernateMappingContext.getHibernatePersistentEntities().stream()
                 .filter(persistentEntity -> 
persistentEntity.forGrailsDomainMapping(dataSourceName))
@@ -552,8 +555,9 @@ public class GrailsDomainBinder
         if (LOG.isDebugEnabled()) {
             LOG.debug("[GrailsDomainBinder] Mapping Grails domain class: " + 
domainClass.getName() + " -> " + root.getTable().getName());
         }
-        bindIdentity(domainClass, root, mappings, gormMapping, 
sessionFactoryBeanName);
-        new VersionBinder(metadataBuildingContext, 
namingStrategy).bindVersion(domainClass.getVersion(), root);
+
+        identityBinder.bindIdentity(domainClass, root, mappings, gormMapping, 
sessionFactoryBeanName);
+        versionBinder.bindVersion(domainClass.getVersion(), root);
         root.createPrimaryKey();
         createClassProperties(domainClass, root, mappings, 
sessionFactoryBeanName);
 
@@ -561,19 +565,6 @@ public class GrailsDomainBinder
     }
 
 
-
-    private void bindIdentity(
-            @Nonnull GrailsHibernatePersistentEntity domainClass,
-            @Nonnull RootClass root,
-            @Nonnull InFlightMetadataCollector mappings,
-            Mapping gormMapping,
-            String sessionFactoryBeanName) {
-
-        CompositeIdBinder compositeIdBinder = new 
CompositeIdBinder(metadataBuildingContext, componentPropertyBinder);
-        new IdentityBinder(metadataBuildingContext, getNamingStrategy(), 
getJdbcEnvironment(), compositeIdBinder)
-                .bindIdentity(domainClass, root, mappings, gormMapping, 
sessionFactoryBeanName);
-    }
-
     /**
      * Creates and binds the properties for the specified Grails domain class 
and PersistentClass
      * and binds them to the Hibernate runtime meta model
@@ -623,6 +614,18 @@ public class GrailsDomainBinder
         return collectionBinder;
     }
 
+    public CompositeIdBinder getCompositeIdBinder() {
+        return compositeIdBinder;
+    }
+
+    public IdentityBinder getIdentityBinder() {
+        return identityBinder;
+    }
+
+    public VersionBinder getVersionBinder() {
+        return versionBinder;
+    }
+
     @Override
     public String getContributorName() {
         return "GORM";
diff --git 
a/grails-data-hibernate7/core/src/main/groovy/org/grails/orm/hibernate/cfg/GrailsHibernatePersistentEntity.java
 
b/grails-data-hibernate7/core/src/main/groovy/org/grails/orm/hibernate/cfg/GrailsHibernatePersistentEntity.java
index b7ad2a50b7..46a291e088 100644
--- 
a/grails-data-hibernate7/core/src/main/groovy/org/grails/orm/hibernate/cfg/GrailsHibernatePersistentEntity.java
+++ 
b/grails-data-hibernate7/core/src/main/groovy/org/grails/orm/hibernate/cfg/GrailsHibernatePersistentEntity.java
@@ -112,5 +112,6 @@ public interface GrailsHibernatePersistentEntity extends 
PersistentEntity {
                 .orElse(NamespaceNameExtractor.getCatalogName(mappings));
 
     }
+
 }
 
diff --git 
a/grails-data-hibernate7/core/src/main/groovy/org/grails/orm/hibernate/cfg/GrailsHibernatePersistentProperty.java
 
b/grails-data-hibernate7/core/src/main/groovy/org/grails/orm/hibernate/cfg/GrailsHibernatePersistentProperty.java
index 9302793678..4139f889d6 100644
--- 
a/grails-data-hibernate7/core/src/main/groovy/org/grails/orm/hibernate/cfg/GrailsHibernatePersistentProperty.java
+++ 
b/grails-data-hibernate7/core/src/main/groovy/org/grails/orm/hibernate/cfg/GrailsHibernatePersistentProperty.java
@@ -134,4 +134,6 @@ public interface GrailsHibernatePersistentProperty extends 
PersistentProperty<Pr
                 .map(ColumnConfig::getName)
                 .orElseGet(() -> namingStrategy.resolveColumnName(getName()) + 
GrailsDomainBinder.UNDERSCORE + IndexedCollection.DEFAULT_ELEMENT_COLUMN_NAME);
     }
+
+
 }
\ No newline at end of file
diff --git 
a/grails-data-hibernate7/core/src/main/groovy/org/grails/orm/hibernate/cfg/domainbinding/ColumnBinder.java
 
b/grails-data-hibernate7/core/src/main/groovy/org/grails/orm/hibernate/cfg/domainbinding/ColumnBinder.java
index 56508df49e..3f06b1b823 100644
--- 
a/grails-data-hibernate7/core/src/main/groovy/org/grails/orm/hibernate/cfg/domainbinding/ColumnBinder.java
+++ 
b/grails-data-hibernate7/core/src/main/groovy/org/grails/orm/hibernate/cfg/domainbinding/ColumnBinder.java
@@ -77,7 +77,7 @@ public class ColumnBinder {
      * @param path
      * @param table          The table name
      */
-    public void bindColumn(PersistentProperty property, PersistentProperty 
parentProperty,
+    public void bindColumn(GrailsHibernatePersistentProperty property, 
GrailsHibernatePersistentProperty parentProperty,
                            Column column, ColumnConfig cc, String path, Table 
table) {
 
         if (cc != null) {
@@ -87,7 +87,7 @@ public class ColumnBinder {
             column.setCustomWrite(cc.getWrite());
         }
 
-        Class<?> userType = ((GrailsHibernatePersistentProperty) 
property).getUserType();
+        Class<?> userType = property.getUserType();
         String columnName = 
columnNameForPropertyAndPathFetcher.getColumnNameForPropertyAndPath(property, 
path, cc);
         if ((property instanceof Association association) && userType == null) 
{
             // Only use conventional naming when the column has not been 
explicitly mapped.
@@ -116,10 +116,10 @@ public class ColumnBinder {
             // the column's length, precision, and scale
             Class<?> type = property.getType();
             if (type != null && (String.class.isAssignableFrom(type) || 
byte[].class.isAssignableFrom(type))) {
-                mappedForm = ((GrailsHibernatePersistentProperty) 
property).getMappedForm();
+                mappedForm = property.getMappedForm();
                 
stringColumnConstraintsBinder.bindStringColumnConstraints(column, mappedForm);
             } else if (type != null && Number.class.isAssignableFrom(type)) {
-                mappedForm = ((GrailsHibernatePersistentProperty) 
property).getMappedForm();
+                mappedForm = property.getMappedForm();
                 
numericColumnConstraintsBinder.bindNumericColumnConstraints(column, cc, 
mappedForm);
             }
         }
@@ -143,7 +143,7 @@ public class ColumnBinder {
         }
 
         // Apply uniqueness last to ensure it isn't overridden by downstream 
binders
-        PropertyConfig mappedFormFinal = ((GrailsHibernatePersistentProperty) 
property).getMappedForm();
+        PropertyConfig mappedFormFinal = property.getMappedForm();
         column.setUnique(mappedFormFinal.isUnique() && 
!mappedFormFinal.isUniqueWithinGroup());
 
         if (LOG.isDebugEnabled())
diff --git 
a/grails-data-hibernate7/core/src/main/groovy/org/grails/orm/hibernate/cfg/domainbinding/GrailsPropertyBinder.java
 
b/grails-data-hibernate7/core/src/main/groovy/org/grails/orm/hibernate/cfg/domainbinding/GrailsPropertyBinder.java
index c51964269e..659b294d7c 100644
--- 
a/grails-data-hibernate7/core/src/main/groovy/org/grails/orm/hibernate/cfg/domainbinding/GrailsPropertyBinder.java
+++ 
b/grails-data-hibernate7/core/src/main/groovy/org/grails/orm/hibernate/cfg/domainbinding/GrailsPropertyBinder.java
@@ -83,7 +83,8 @@ public class GrailsPropertyBinder {
     }
 
     public Value bindProperty(PersistentClass persistentClass
-            , @Nonnull GrailsHibernatePersistentProperty currentGrailsProp, 
@Nonnull InFlightMetadataCollector mappings
+            , @Nonnull GrailsHibernatePersistentProperty currentGrailsProp
+            , @Nonnull InFlightMetadataCollector mappings
             , String sessionFactoryBeanName) {
         if (LOG.isDebugEnabled()) {
             LOG.debug("[GrailsPropertyBinder] Binding persistent property [" + 
currentGrailsProp.getName() + "]");
@@ -110,8 +111,7 @@ public class GrailsPropertyBinder {
                 simpleValueBinder.bindSimpleValue(currentGrailsProp, 
null,(SimpleValue) value, EMPTY_PATH);// No specific binder call needed
             }
             else { // Actual Collection
-                Collection collection = 
collectionType.create((HibernateToManyProperty) currentGrailsProp, 
persistentClass
-                );
+                Collection collection = 
collectionType.create((HibernateToManyProperty) currentGrailsProp, 
persistentClass);
                 collectionBinder.bindCollection((HibernateToManyProperty) 
currentGrailsProp, collection, persistentClass, mappings, EMPTY_PATH, 
sessionFactoryBeanName);
                 mappings.addCollectionBinding(collection);
                 value = collection;
diff --git 
a/grails-data-hibernate7/core/src/main/groovy/org/grails/orm/hibernate/cfg/domainbinding/SimpleValueBinder.java
 
b/grails-data-hibernate7/core/src/main/groovy/org/grails/orm/hibernate/cfg/domainbinding/SimpleValueBinder.java
index fbca633dc5..cc93ba628b 100644
--- 
a/grails-data-hibernate7/core/src/main/groovy/org/grails/orm/hibernate/cfg/domainbinding/SimpleValueBinder.java
+++ 
b/grails-data-hibernate7/core/src/main/groovy/org/grails/orm/hibernate/cfg/domainbinding/SimpleValueBinder.java
@@ -131,7 +131,7 @@ public class SimpleValueBinder {
                     .forEach(cc -> {
                         Column column = new Column();
                         
columnConfigToColumnBinder.bindColumnConfigToColumn(column, cc, propertyConfig);
-                        columnBinder.bindColumn(property, parentProperty, 
column, cc, path, table);
+                        
columnBinder.bindColumn((GrailsHibernatePersistentProperty) property, 
(GrailsHibernatePersistentProperty) parentProperty, column, cc, path, table);
                         if (simpleValue instanceof 
org.hibernate.mapping.DependantValue) {
                             column.setNullable(true);
                         }
diff --git 
a/grails-data-hibernate7/core/src/test/groovy/org/grails/orm/hibernate/cfg/domainbinding/ColumnBinderSpec.groovy
 
b/grails-data-hibernate7/core/src/test/groovy/org/grails/orm/hibernate/cfg/domainbinding/ColumnBinderSpec.groovy
index b187d85727..755f83919f 100644
--- 
a/grails-data-hibernate7/core/src/test/groovy/org/grails/orm/hibernate/cfg/domainbinding/ColumnBinderSpec.groovy
+++ 
b/grails-data-hibernate7/core/src/test/groovy/org/grails/orm/hibernate/cfg/domainbinding/ColumnBinderSpec.groovy
@@ -62,7 +62,7 @@ class ColumnBinderSpec extends HibernateGormDatastoreSpec {
 
         def entity = createPersistentEntity(CBNumericSub)
         def prop = entity.getPropertyByName("num")
-        def parentProp = Mock(PersistentProperty)
+        def parentProp = Mock(GrailsHibernatePersistentProperty)
         def column = new Column("test")
         def table = new Table()
         def cc = new ColumnConfig(comment: "cmt", defaultValue: "def", read: 
"r", write: "w")
@@ -274,7 +274,7 @@ class ColumnBinderSpec extends HibernateGormDatastoreSpec {
 
         def entity = createPersistentEntity(CBNullableEntity)
         def prop = entity.getPropertyByName("nullableProp")
-        def parentProp = Mock(PersistentProperty)
+        def parentProp = Mock(GrailsHibernatePersistentProperty)
         def column = new Column("test")
         def table = new Table()
 
@@ -309,7 +309,7 @@ class ColumnBinderSpec extends HibernateGormDatastoreSpec {
 
         def entity = createPersistentEntity(CBBook)
         def prop = entity.getPropertyByName("title")
-        def parentProp = Mock(PersistentProperty)
+        def parentProp = Mock(GrailsHibernatePersistentProperty)
         def column = new Column("test")
         def table = new Table()
 
@@ -344,7 +344,7 @@ class ColumnBinderSpec extends HibernateGormDatastoreSpec {
 
         def entity = createPersistentEntity(CBBook)
         def prop = entity.getPropertyByName("title")
-        def parentProp = Mock(PersistentProperty)
+        def parentProp = Mock(GrailsHibernatePersistentProperty)
         def column = new Column("test")
         def table = new Table()
 
diff --git 
a/grails-data-hibernate7/core/src/test/groovy/org/grails/orm/hibernate/cfg/domainbinding/ComponentPropertyBinderSpec.groovy
 
b/grails-data-hibernate7/core/src/test/groovy/org/grails/orm/hibernate/cfg/domainbinding/ComponentPropertyBinderSpec.groovy
index 265b8d8715..31ca4f248e 100644
--- 
a/grails-data-hibernate7/core/src/test/groovy/org/grails/orm/hibernate/cfg/domainbinding/ComponentPropertyBinderSpec.groovy
+++ 
b/grails-data-hibernate7/core/src/test/groovy/org/grails/orm/hibernate/cfg/domainbinding/ComponentPropertyBinderSpec.groovy
@@ -80,7 +80,7 @@ class ComponentPropertyBinderSpec extends 
HibernateGormDatastoreSpec {
         def ownerEntity = Mock(GrailsHibernatePersistentEntity)
         ownerEntity.isRoot() >> true
         def currentGrailsProp = Mock(GrailsHibernatePersistentProperty)
-        def componentProperty = Mock(PersistentProperty)
+        def componentProperty = Mock(GrailsHibernatePersistentProperty)
         def mappings = Mock(InFlightMetadataCollector)
         def hibernateProperty = new Property()
         hibernateProperty.setName("street")
@@ -110,7 +110,7 @@ class ComponentPropertyBinderSpec extends 
HibernateGormDatastoreSpec {
         def ownerEntity = Mock(GrailsHibernatePersistentEntity)
         ownerEntity.isRoot() >> true
         def currentGrailsProp = Mock(TestManyToOne)
-        def componentProperty = Mock(PersistentProperty)
+        def componentProperty = Mock(GrailsHibernatePersistentProperty)
         def mappings = Mock(InFlightMetadataCollector)
         def hibernateProperty = new Property()
         hibernateProperty.setName("owner")
@@ -141,7 +141,7 @@ class ComponentPropertyBinderSpec extends 
HibernateGormDatastoreSpec {
         def ownerEntity = Mock(GrailsHibernatePersistentEntity)
         ownerEntity.isRoot() >> true
         def currentGrailsProp = Mock(TestOneToOne)
-        def componentProperty = Mock(PersistentProperty)
+        def componentProperty = Mock(GrailsHibernatePersistentProperty)
         def mappings = Mock(InFlightMetadataCollector)
         def hibernateProperty = new Property()
         hibernateProperty.setName("detail")
@@ -177,7 +177,7 @@ class ComponentPropertyBinderSpec extends 
HibernateGormDatastoreSpec {
         def ownerEntity = Mock(GrailsHibernatePersistentEntity)
         ownerEntity.isRoot() >> true
         def currentGrailsProp = Mock(GrailsHibernatePersistentProperty)
-        def componentProperty = Mock(PersistentProperty)
+        def componentProperty = Mock(GrailsHibernatePersistentProperty)
         def mappings = Mock(InFlightMetadataCollector)
         def hibernateProperty = new Property()
         hibernateProperty.setName("type")
@@ -208,7 +208,7 @@ class ComponentPropertyBinderSpec extends 
HibernateGormDatastoreSpec {
         def ownerEntity = Mock(GrailsHibernatePersistentEntity)
         ownerEntity.isRoot() >> true
         def currentGrailsProp = Mock(GrailsHibernatePersistentProperty)
-        def componentProperty = Mock(PersistentProperty)
+        def componentProperty = Mock(GrailsHibernatePersistentProperty)
         def ownerEntityGHPE = Mock(GrailsHibernatePersistentEntity)
         def mappings = Mock(InFlightMetadataCollector)
         def hibernateProperty = new Property()
diff --git 
a/grails-data-hibernate7/core/src/test/groovy/org/grails/orm/hibernate/cfg/domainbinding/SimpleValueBinderSpec.groovy
 
b/grails-data-hibernate7/core/src/test/groovy/org/grails/orm/hibernate/cfg/domainbinding/SimpleValueBinderSpec.groovy
index 9b89ca4f09..c58ab6ddce 100644
--- 
a/grails-data-hibernate7/core/src/test/groovy/org/grails/orm/hibernate/cfg/domainbinding/SimpleValueBinderSpec.groovy
+++ 
b/grails-data-hibernate7/core/src/test/groovy/org/grails/orm/hibernate/cfg/domainbinding/SimpleValueBinderSpec.groovy
@@ -171,7 +171,7 @@ class SimpleValueBinderSpec extends Specification {
     def "binds for each provided column config and adds to table and simple 
value"() {
         given:
         def prop = Mock(GrailsHibernatePersistentProperty)
-        def parent = Mock(PersistentProperty)
+        def parent = Mock(GrailsHibernatePersistentProperty)
         def owner = Mock(GrailsHibernatePersistentEntity)
         def mapping = Mock(Mapping)
         def pc = Mock(PropertyConfig)

Reply via email to