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 d726a424f011d9cfb23e00d6cc682acbfc08624a Author: Walter Duque de Estrada <[email protected]> AuthorDate: Mon Feb 16 15:48:08 2026 -0600 Pass Table as argument to GrailsPropertyBinder.bindProperty - Update GrailsPropertyBinder.bindProperty to take Table as an explicit argument. - Update ClassPropertiesBinder to extract Table once and pass it to bindProperty. - Update GrailsPropertyBinderSpec and ClassPropertiesBinderSpec to align with the new signature. --- .../domainbinding/binder/ClassPropertiesBinder.java | 4 +++- .../cfg/domainbinding/binder/GrailsPropertyBinder.java | 2 +- .../cfg/domainbinding/GrailsPropertyBinderSpec.groovy | 18 +++++++++--------- .../binder/ClassPropertiesBinderSpec.groovy | 4 ++-- 4 files changed, 15 insertions(+), 13 deletions(-) diff --git a/grails-data-hibernate7/core/src/main/groovy/org/grails/orm/hibernate/cfg/domainbinding/binder/ClassPropertiesBinder.java b/grails-data-hibernate7/core/src/main/groovy/org/grails/orm/hibernate/cfg/domainbinding/binder/ClassPropertiesBinder.java index 3e41d3fad9..cdfd1de212 100644 --- a/grails-data-hibernate7/core/src/main/groovy/org/grails/orm/hibernate/cfg/domainbinding/binder/ClassPropertiesBinder.java +++ b/grails-data-hibernate7/core/src/main/groovy/org/grails/orm/hibernate/cfg/domainbinding/binder/ClassPropertiesBinder.java @@ -6,6 +6,7 @@ import org.grails.orm.hibernate.cfg.GrailsHibernatePersistentProperty; import org.grails.orm.hibernate.cfg.domainbinding.util.PropertyFromValueCreator; import org.hibernate.boot.spi.InFlightMetadataCollector; import org.hibernate.mapping.PersistentClass; +import org.hibernate.mapping.Table; import org.hibernate.mapping.Value; /** @@ -45,9 +46,10 @@ public class ClassPropertiesBinder { @Nonnull InFlightMetadataCollector mappings) { persistentClass.getTable().setComment(domainClass.getMappedForm().getComment()); + Table table = persistentClass.getTable(); for (GrailsHibernatePersistentProperty currentGrailsProp : domainClass.getPersistentPropertiesToBind()) { - Value value = grailsPropertyBinder.bindProperty(persistentClass, currentGrailsProp, mappings); + Value value = grailsPropertyBinder.bindProperty(persistentClass, table, currentGrailsProp, mappings); persistentClass.addProperty(propertyFromValueCreator.createProperty(value, currentGrailsProp)); } diff --git a/grails-data-hibernate7/core/src/main/groovy/org/grails/orm/hibernate/cfg/domainbinding/binder/GrailsPropertyBinder.java b/grails-data-hibernate7/core/src/main/groovy/org/grails/orm/hibernate/cfg/domainbinding/binder/GrailsPropertyBinder.java index 420d21fe7e..fccd94fd38 100644 --- a/grails-data-hibernate7/core/src/main/groovy/org/grails/orm/hibernate/cfg/domainbinding/binder/GrailsPropertyBinder.java +++ b/grails-data-hibernate7/core/src/main/groovy/org/grails/orm/hibernate/cfg/domainbinding/binder/GrailsPropertyBinder.java @@ -70,12 +70,12 @@ public class GrailsPropertyBinder { } public Value bindProperty(PersistentClass persistentClass + , Table table , @Nonnull GrailsHibernatePersistentProperty currentGrailsProp , @Nonnull InFlightMetadataCollector mappings) { if (LOG.isDebugEnabled()) { LOG.debug("[GrailsPropertyBinder] Binding persistent property [" + currentGrailsProp.getName() + "]"); } - Table table = persistentClass.getTable(); Value value = null; diff --git a/grails-data-hibernate7/core/src/test/groovy/org/grails/orm/hibernate/cfg/domainbinding/GrailsPropertyBinderSpec.groovy b/grails-data-hibernate7/core/src/test/groovy/org/grails/orm/hibernate/cfg/domainbinding/GrailsPropertyBinderSpec.groovy index e3d667358a..355bf77bf9 100644 --- a/grails-data-hibernate7/core/src/test/groovy/org/grails/orm/hibernate/cfg/domainbinding/GrailsPropertyBinderSpec.groovy +++ b/grails-data-hibernate7/core/src/test/groovy/org/grails/orm/hibernate/cfg/domainbinding/GrailsPropertyBinderSpec.groovy @@ -228,7 +228,7 @@ class GrailsPropertyBinderSpec extends HibernateGormDatastoreSpec { when: def titleProp = persistentEntity.getPropertyByName("title") as GrailsHibernatePersistentProperty - Value value = propertyBinder.bindProperty(rootClass, titleProp, collector) + Value value = propertyBinder.bindProperty(rootClass, rootClass.table, titleProp, collector) rootClass.addProperty(new PropertyFromValueCreator().createProperty(value, titleProp)) then: @@ -256,7 +256,7 @@ class GrailsPropertyBinderSpec extends HibernateGormDatastoreSpec { statusProp.isHibernateManyToOne() >> false when: - Value value = propertyBinder.bindProperty(rootClass, statusProp, collector) + Value value = propertyBinder.bindProperty(rootClass, rootClass.table, statusProp, collector) rootClass.addProperty(new PropertyFromValueCreator().createProperty(value, statusProp)) then: @@ -282,7 +282,7 @@ class GrailsPropertyBinderSpec extends HibernateGormDatastoreSpec { when: def ownerProp = petEntity.getPropertyByName("owner") as GrailsHibernatePersistentProperty - Value value = propertyBinder.bindProperty(rootClass, ownerProp, collector) + Value value = propertyBinder.bindProperty(rootClass, rootClass.table, ownerProp, collector) rootClass.addProperty(new PropertyFromValueCreator().createProperty(value, ownerProp)) then: @@ -305,7 +305,7 @@ class GrailsPropertyBinderSpec extends HibernateGormDatastoreSpec { when: def addressProp = persistentEntity.getPropertyByName("homeAddress") as GrailsHibernatePersistentProperty - Value value = propertyBinder.bindProperty(rootClass, addressProp, collector) + Value value = propertyBinder.bindProperty(rootClass, rootClass.table, addressProp, collector) rootClass.addProperty(new PropertyFromValueCreator().createProperty(value, addressProp)) then: @@ -333,7 +333,7 @@ class GrailsPropertyBinderSpec extends HibernateGormDatastoreSpec { when: def petsProp = personEntity.getPropertyByName("pets") as GrailsHibernatePersistentProperty - Value value = propertyBinder.bindProperty(rootClass, petsProp, collector) + Value value = propertyBinder.bindProperty(rootClass, rootClass.table, petsProp, collector) rootClass.addProperty(new PropertyFromValueCreator().createProperty(value, petsProp)) then: @@ -372,7 +372,7 @@ class GrailsPropertyBinderSpec extends HibernateGormDatastoreSpec { when: def booksProp = authorEntity.getPropertyByName("books") as GrailsHibernatePersistentProperty - Value value = propertyBinder.bindProperty(rootClass, booksProp, collector) + Value value = propertyBinder.bindProperty(rootClass, rootClass.table, booksProp, collector) rootClass.addProperty(new PropertyFromValueCreator().createProperty(value, booksProp)) collector.processSecondPasses(binder.getMetadataBuildingContext()) @@ -411,7 +411,7 @@ class GrailsPropertyBinderSpec extends HibernateGormDatastoreSpec { when: def booksProp = authorEntity.getPropertyByName("books") as GrailsHibernatePersistentProperty - Value value = propertyBinder.bindProperty(rootClass, booksProp, collector) + Value value = propertyBinder.bindProperty(rootClass, rootClass.table, booksProp, collector) rootClass.addProperty(new PropertyFromValueCreator().createProperty(value, booksProp)) collector.processSecondPasses(binder.getMetadataBuildingContext()) @@ -472,7 +472,7 @@ class GrailsPropertyBinderSpec extends HibernateGormDatastoreSpec { when: def childBookProp = authorEntity.getPropertyByName("childBook") as GrailsHibernatePersistentProperty - Value value = propertyBinder.bindProperty(rootClass, childBookProp, collector) + Value value = propertyBinder.bindProperty(rootClass, rootClass.table, childBookProp, collector) rootClass.addProperty(new PropertyFromValueCreator().createProperty(value, childBookProp)) // Process second passes to ensure Hibernate's internal mappings are finalized collector.processSecondPasses(binder.getMetadataBuildingContext()) @@ -540,7 +540,7 @@ class GrailsPropertyBinderSpec extends HibernateGormDatastoreSpec { when: // Capture the return value of bindProperty - def resultValue = propertyBinder.bindProperty(rootClass, currentGrailsProp, mappings) + def resultValue = propertyBinder.bindProperty(rootClass, table, currentGrailsProp, mappings) then: // Assert that bindProperty returns a Value object diff --git a/grails-data-hibernate7/core/src/test/groovy/org/grails/orm/hibernate/cfg/domainbinding/binder/ClassPropertiesBinderSpec.groovy b/grails-data-hibernate7/core/src/test/groovy/org/grails/orm/hibernate/cfg/domainbinding/binder/ClassPropertiesBinderSpec.groovy index 739cf51730..a28872e880 100644 --- a/grails-data-hibernate7/core/src/test/groovy/org/grails/orm/hibernate/cfg/domainbinding/binder/ClassPropertiesBinderSpec.groovy +++ b/grails-data-hibernate7/core/src/test/groovy/org/grails/orm/hibernate/cfg/domainbinding/binder/ClassPropertiesBinderSpec.groovy @@ -44,10 +44,10 @@ class ClassPropertiesBinderSpec extends HibernateGormDatastoreSpec { binder.bindClassProperties(domainClass, persistentClass, mappings) then: - 1 * grailsPropertyBinder.bindProperty(persistentClass, prop1, mappings) >> value1 + 1 * grailsPropertyBinder.bindProperty(persistentClass, persistentClass.table, prop1, mappings) >> value1 1 * propertyFromValueCreator.createProperty(value1, prop1) >> hibernateProp1 - 1 * grailsPropertyBinder.bindProperty(persistentClass, prop2, mappings) >> value2 + 1 * grailsPropertyBinder.bindProperty(persistentClass, persistentClass.table, prop2, mappings) >> value2 1 * propertyFromValueCreator.createProperty(value2, prop2) >> hibernateProp2 persistentClass.getProperty("hibernateProp1") == hibernateProp1
