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 d881e24d8dbc6de9700791df0a14a4e9729ac425 Author: Walter Duque de Estrada <[email protected]> AuthorDate: Sat Feb 14 10:10:34 2026 -0600 Eliminate varargs from SimpleValueBinder.bindSimpleValue. - SimpleValueBinder: Removed typeProperty varargs; now internally resolves the owner's identity property when binding a DependantValue. - CollectionSecondPassBinder: Updated call to bindSimpleValue to remove the redundant identity argument. - Updated VersionBinderSpec and ComponentPropertyBinderSpec to match the new bindSimpleValue signature. --- .../cfg/domainbinding/binder/SimpleValueBinder.java | 13 +++++-------- .../secondpass/CollectionSecondPassBinder.java | 7 +------ .../cfg/domainbinding/ComponentPropertyBinderSpec.groovy | 5 ++--- .../hibernate/cfg/domainbinding/VersionBinderSpec.groovy | 2 +- 4 files changed, 9 insertions(+), 18 deletions(-) diff --git a/grails-data-hibernate7/core/src/main/groovy/org/grails/orm/hibernate/cfg/domainbinding/binder/SimpleValueBinder.java b/grails-data-hibernate7/core/src/main/groovy/org/grails/orm/hibernate/cfg/domainbinding/binder/SimpleValueBinder.java index 776ca244d3..bc03a8c84a 100644 --- a/grails-data-hibernate7/core/src/main/groovy/org/grails/orm/hibernate/cfg/domainbinding/binder/SimpleValueBinder.java +++ b/grails-data-hibernate7/core/src/main/groovy/org/grails/orm/hibernate/cfg/domainbinding/binder/SimpleValueBinder.java @@ -60,16 +60,13 @@ public class SimpleValueBinder { @jakarta.annotation.Nonnull GrailsHibernatePersistentProperty property, GrailsHibernatePersistentProperty parentProperty, SimpleValue simpleValue, - String path, - GrailsHibernatePersistentProperty... typeProperty) { + String path) { - final GrailsHibernatePersistentProperty actualTypeProperty = (typeProperty.length > 0 && typeProperty[0] != null) ? typeProperty[0] : property; - PropertyConfig propertyConfig = property.getMappedForm(); - Mapping mapping = null; - if (property.getOwner() instanceof GrailsHibernatePersistentEntity persistentEntity) { - mapping = persistentEntity.getMappedForm(); + GrailsHibernatePersistentProperty actualTypeProperty = property; + if (simpleValue instanceof DependantValue) { + actualTypeProperty = Optional.ofNullable(property.getHibernateOwner().getIdentity()).orElse(property); } - + PropertyConfig propertyConfig = property.getMappedForm(); final String typeName = actualTypeProperty.getTypeName(); if (typeName == null) { if (!(actualTypeProperty instanceof org.grails.datastore.mapping.model.types.Association)) { diff --git a/grails-data-hibernate7/core/src/main/groovy/org/grails/orm/hibernate/cfg/domainbinding/secondpass/CollectionSecondPassBinder.java b/grails-data-hibernate7/core/src/main/groovy/org/grails/orm/hibernate/cfg/domainbinding/secondpass/CollectionSecondPassBinder.java index c53b7698b8..779dd7b8e4 100644 --- a/grails-data-hibernate7/core/src/main/groovy/org/grails/orm/hibernate/cfg/domainbinding/secondpass/CollectionSecondPassBinder.java +++ b/grails-data-hibernate7/core/src/main/groovy/org/grails/orm/hibernate/cfg/domainbinding/secondpass/CollectionSecondPassBinder.java @@ -363,12 +363,7 @@ public class CollectionSecondPassBinder { } else { // set type - GrailsHibernatePersistentProperty identity = refDomainClass.getIdentity(); - if (identity != null) { - new SimpleValueBinder(namingStrategy).bindSimpleValue(property, null, key, EMPTY_PATH, identity); - } else { - new SimpleValueBinder(namingStrategy).bindSimpleValue(property, null, key, EMPTY_PATH); - } + new SimpleValueBinder(namingStrategy).bindSimpleValue(property, null, key, EMPTY_PATH); } } 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 c6dc4a1aed..7495a0d0e1 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 @@ -115,7 +115,7 @@ class ComponentPropertyBinderSpec extends HibernateGormDatastoreSpec { binder.bindComponentProperty(component, componentProperty, currentGrailsProp, root, "address", table, mappings, "sessionFactory") then: - 1 * mockSimpleValueBinder.bindSimpleValue(currentGrailsProp, componentProperty, _ as BasicValue, "address", _) + 1 * mockSimpleValueBinder.bindSimpleValue(currentGrailsProp, componentProperty, _ as BasicValue, "address") component.getProperty("street") == hibernateProperty } @@ -256,8 +256,7 @@ class ComponentPropertyBinderSpec extends HibernateGormDatastoreSpec { currentGrailsProp, componentProperty, _ as BasicValue, - "address", - _ + "address" ) 1 * ownerEntity.isComponentPropertyNullable(componentProperty) >> true } diff --git a/grails-data-hibernate7/core/src/test/groovy/org/grails/orm/hibernate/cfg/domainbinding/VersionBinderSpec.groovy b/grails-data-hibernate7/core/src/test/groovy/org/grails/orm/hibernate/cfg/domainbinding/VersionBinderSpec.groovy index 88084fb6a0..4e8c2ff408 100644 --- a/grails-data-hibernate7/core/src/test/groovy/org/grails/orm/hibernate/cfg/domainbinding/VersionBinderSpec.groovy +++ b/grails-data-hibernate7/core/src/test/groovy/org/grails/orm/hibernate/cfg/domainbinding/VersionBinderSpec.groovy @@ -51,7 +51,7 @@ class VersionBinderSpec extends HibernateGormDatastoreSpec { then: 1 * basicValueFactory.apply(metadataBuildingContext, table) >> basicValue - 1 * simpleValueBinder.bindSimpleValue(versionProperty, null, basicValue, "", _) + 1 * simpleValueBinder.bindSimpleValue(versionProperty, null, basicValue, "") 1 * propertyBinder.bindProperty(versionProperty, basicValue) rootClass.getVersion() != null
