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 4a41f9199fdc2836f13446d32b5a4137915ae6be Author: Walter Duque de Estrada <[email protected]> AuthorDate: Sun Feb 15 20:41:05 2026 -0600 update GrailsPropertyBinder to use ComponentBinder instead of ComponentPropertyBinder --- .../orm/hibernate/cfg/GrailsDomainBinder.java | 4 +++- .../cfg/domainbinding/binder/ComponentBinder.java | 4 ---- .../binder/ComponentPropertyBinder.java | 21 ++------------------- .../domainbinding/binder/GrailsPropertyBinder.java | 12 ++++++------ .../cfg/domainbinding/CollectionBinderSpec.groovy | 4 +++- .../CollectionSecondPassBinderSpec.groovy | 4 +++- .../domainbinding/GrailsPropertyBinderSpec.groovy | 8 +++++--- .../domainbinding/ListSecondPassBinderSpec.groovy | 4 +++- .../domainbinding/MapSecondPassBinderSpec.groovy | 4 +++- 9 files changed, 28 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 eaaaa6305b..4439ad5a8e 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 @@ -17,6 +17,7 @@ package org.grails.orm.hibernate.cfg; import org.grails.orm.hibernate.cfg.domainbinding.binder.ClassPropertiesBinder; import org.grails.orm.hibernate.cfg.domainbinding.binder.ClassBinder; import org.grails.orm.hibernate.cfg.domainbinding.binder.ColumnConfigToColumnBinder; +import org.grails.orm.hibernate.cfg.domainbinding.binder.ComponentBinder; import org.grails.orm.hibernate.cfg.domainbinding.binder.ComponentPropertyBinder; import org.grails.orm.hibernate.cfg.domainbinding.binder.CompositeIdBinder; import org.grails.orm.hibernate.cfg.domainbinding.binder.EnumTypeBinder; @@ -197,12 +198,13 @@ public class GrailsDomainBinder manyToOneBinder, columnNameForPropertyAndPathFetcher ); + ComponentBinder componentBinder = new ComponentBinder(getMappingCacheHolder(), componentPropertyBinder); GrailsPropertyBinder grailsPropertyBinder = new GrailsPropertyBinder( metadataBuildingContext, namingStrategy, collectionHolder, enumTypeBinder, - componentPropertyBinder, + componentBinder, collectionBinder, simpleValueBinder, columnNameForPropertyAndPathFetcher, diff --git a/grails-data-hibernate7/core/src/main/groovy/org/grails/orm/hibernate/cfg/domainbinding/binder/ComponentBinder.java b/grails-data-hibernate7/core/src/main/groovy/org/grails/orm/hibernate/cfg/domainbinding/binder/ComponentBinder.java index 560ed648cd..262b702522 100644 --- a/grails-data-hibernate7/core/src/main/groovy/org/grails/orm/hibernate/cfg/domainbinding/binder/ComponentBinder.java +++ b/grails-data-hibernate7/core/src/main/groovy/org/grails/orm/hibernate/cfg/domainbinding/binder/ComponentBinder.java @@ -24,10 +24,6 @@ public class ComponentBinder { this.componentPropertyBinder = componentPropertyBinder; } - protected ComponentBinder() { - this.mappingCacheHolder = null; - this.componentPropertyBinder = null; - } public void bindComponent(Component component, HibernateEmbeddedProperty property, @Nonnull InFlightMetadataCollector mappings) { diff --git a/grails-data-hibernate7/core/src/main/groovy/org/grails/orm/hibernate/cfg/domainbinding/binder/ComponentPropertyBinder.java b/grails-data-hibernate7/core/src/main/groovy/org/grails/orm/hibernate/cfg/domainbinding/binder/ComponentPropertyBinder.java index bb4e015575..52402339b3 100644 --- a/grails-data-hibernate7/core/src/main/groovy/org/grails/orm/hibernate/cfg/domainbinding/binder/ComponentPropertyBinder.java +++ b/grails-data-hibernate7/core/src/main/groovy/org/grails/orm/hibernate/cfg/domainbinding/binder/ComponentPropertyBinder.java @@ -97,21 +97,7 @@ public class ComponentPropertyBinder { this.columnNameForPropertyAndPathFetcher = columnNameForPropertyAndPathFetcher; } - protected ComponentPropertyBinder() { - this.metadataBuildingContext = null; - this.namingStrategy = null; - this.jdbcEnvironment = null; - this.mappingCacheHolder = null; - this.collectionHolder = null; - this.enumTypeBinder = null; - this.collectionBinder = null; - this.propertyFromValueCreator = null; - this.componentBinder = null; - this.simpleValueBinder = null; - this.manyToOneBinder = null; - this.oneToOneBinder = null; - this.columnNameForPropertyAndPathFetcher = null; - } + public void bindComponentProperty(Component component, GrailsHibernatePersistentProperty componentProperty, @@ -180,8 +166,5 @@ public class ComponentPropertyBinder { } } - public void bindComponent(Component component, HibernateEmbeddedProperty property, - boolean isNullable, @Nonnull InFlightMetadataCollector mappings) { - componentBinder.bindComponent(component, property, mappings); - } + } 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 82a678f698..a22bfb3d8f 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 @@ -38,7 +38,7 @@ public class GrailsPropertyBinder { private final MetadataBuildingContext metadataBuildingContext; private final CollectionHolder collectionHolder; private final EnumTypeBinder enumTypeBinder; - private final ComponentPropertyBinder componentPropertyBinder; + private final ComponentBinder componentBinder; private final CollectionBinder collectionBinder; private final SimpleValueBinder simpleValueBinder; private final ColumnNameForPropertyAndPathFetcher columnNameForPropertyAndPathFetcher; @@ -51,7 +51,7 @@ public class GrailsPropertyBinder { PersistentEntityNamingStrategy namingStrategy, CollectionHolder collectionHolder, EnumTypeBinder enumTypeBinder, - ComponentPropertyBinder componentPropertyBinder, + ComponentBinder componentBinder, CollectionBinder collectionBinder, SimpleValueBinder simpleValueBinder, ColumnNameForPropertyAndPathFetcher columnNameForPropertyAndPathFetcher, @@ -61,7 +61,7 @@ public class GrailsPropertyBinder { this.metadataBuildingContext = metadataBuildingContext; this.collectionHolder = collectionHolder; this.enumTypeBinder = enumTypeBinder; - this.componentPropertyBinder = componentPropertyBinder; + this.componentBinder = componentBinder; this.collectionBinder = collectionBinder; this.simpleValueBinder = simpleValueBinder; this.columnNameForPropertyAndPathFetcher = columnNameForPropertyAndPathFetcher; @@ -75,14 +75,14 @@ public class GrailsPropertyBinder { PersistentEntityNamingStrategy namingStrategy, CollectionHolder collectionHolder, EnumTypeBinder enumTypeBinder, - ComponentPropertyBinder componentPropertyBinder, + ComponentBinder componentBinder, CollectionBinder collectionBinder, PropertyFromValueCreator propertyFromValueCreator) { this(metadataBuildingContext, namingStrategy, collectionHolder, enumTypeBinder, - componentPropertyBinder, + componentBinder, collectionBinder, new SimpleValueBinder(namingStrategy, ((NamingStrategyWrapper)namingStrategy).getJdbcEnvironment()), new ColumnNameForPropertyAndPathFetcher(namingStrategy, new DefaultColumnNameFetcher(namingStrategy), new BackticksRemover()), @@ -139,7 +139,7 @@ public class GrailsPropertyBinder { } else if (currentGrailsProp instanceof HibernateEmbeddedProperty embedded) { value = new Component(metadataBuildingContext, persistentClass); - componentPropertyBinder.bindComponent((Component)value, embedded, true, mappings); + componentBinder.bindComponent((Component)value, embedded,mappings); } // work out what type of relationship it is and bind value else { // Default BasicValue diff --git a/grails-data-hibernate7/core/src/test/groovy/org/grails/orm/hibernate/cfg/domainbinding/CollectionBinderSpec.groovy b/grails-data-hibernate7/core/src/test/groovy/org/grails/orm/hibernate/cfg/domainbinding/CollectionBinderSpec.groovy index b4219bea59..804e04ec9b 100644 --- a/grails-data-hibernate7/core/src/test/groovy/org/grails/orm/hibernate/cfg/domainbinding/CollectionBinderSpec.groovy +++ b/grails-data-hibernate7/core/src/test/groovy/org/grails/orm/hibernate/cfg/domainbinding/CollectionBinderSpec.groovy @@ -34,6 +34,7 @@ import org.grails.orm.hibernate.cfg.domainbinding.util.DefaultColumnNameFetcher import org.grails.orm.hibernate.cfg.domainbinding.util.ColumnNameForPropertyAndPathFetcher import org.grails.orm.hibernate.cfg.domainbinding.collectionType.CollectionHolder import org.grails.orm.hibernate.cfg.domainbinding.util.PropertyFromValueCreator +import org.grails.orm.hibernate.cfg.domainbinding.binder.ComponentBinder import org.grails.orm.hibernate.cfg.domainbinding.binder.ComponentPropertyBinder import org.grails.orm.hibernate.cfg.domainbinding.util.BasicValueIdCreator @@ -93,12 +94,13 @@ class CollectionBinderSpec extends HibernateGormDatastoreSpec { manyToOneBinder, columnNameForPropertyAndPathFetcher ) + ComponentBinder componentBinder = new ComponentBinder(binder.getMappingCacheHolder(), componentPropertyBinder) GrailsPropertyBinder propertyBinder = new GrailsPropertyBinder( metadataBuildingContext, namingStrategy, collectionHolder, enumTypeBinderToUse, - componentPropertyBinder, + componentBinder, collectionBinder, simpleValueBinder, columnNameForPropertyAndPathFetcher, diff --git a/grails-data-hibernate7/core/src/test/groovy/org/grails/orm/hibernate/cfg/domainbinding/CollectionSecondPassBinderSpec.groovy b/grails-data-hibernate7/core/src/test/groovy/org/grails/orm/hibernate/cfg/domainbinding/CollectionSecondPassBinderSpec.groovy index 28f3f8b16e..3161939a17 100644 --- a/grails-data-hibernate7/core/src/test/groovy/org/grails/orm/hibernate/cfg/domainbinding/CollectionSecondPassBinderSpec.groovy +++ b/grails-data-hibernate7/core/src/test/groovy/org/grails/orm/hibernate/cfg/domainbinding/CollectionSecondPassBinderSpec.groovy @@ -27,6 +27,7 @@ import org.grails.orm.hibernate.cfg.domainbinding.secondpass.CollectionSecondPas import org.grails.orm.hibernate.cfg.domainbinding.binder.OneToOneBinder import org.grails.orm.hibernate.cfg.domainbinding.binder.ClassBinder +import org.grails.orm.hibernate.cfg.domainbinding.binder.ComponentBinder import org.grails.orm.hibernate.cfg.domainbinding.binder.ComponentPropertyBinder import org.grails.orm.hibernate.cfg.domainbinding.util.BasicValueIdCreator import org.grails.orm.hibernate.cfg.domainbinding.binder.GrailsPropertyBinder @@ -95,12 +96,13 @@ class CollectionSecondPassBinderSpec extends HibernateGormDatastoreSpec { manyToOneBinder, columnNameForPropertyAndPathFetcher ) + ComponentBinder componentBinder = new ComponentBinder(binder.getMappingCacheHolder(), componentPropertyBinder) GrailsPropertyBinder propertyBinder = new GrailsPropertyBinder( metadataBuildingContext, namingStrategy, collectionHolder, enumTypeBinderToUse, - componentPropertyBinder, + componentBinder, collectionBinder, simpleValueBinder, columnNameForPropertyAndPathFetcher, 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 f2d70c1df4..84e92b4278 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 @@ -13,6 +13,7 @@ import org.hibernate.mapping.Value import org.grails.orm.hibernate.cfg.domainbinding.binder.CollectionBinder import org.grails.orm.hibernate.cfg.domainbinding.binder.ClassBinder +import org.grails.orm.hibernate.cfg.domainbinding.binder.ComponentBinder import org.grails.orm.hibernate.cfg.domainbinding.binder.ComponentPropertyBinder import org.grails.orm.hibernate.cfg.domainbinding.binder.EnumTypeBinder import org.grails.orm.hibernate.cfg.domainbinding.binder.GrailsPropertyBinder @@ -97,12 +98,13 @@ class GrailsPropertyBinderSpec extends HibernateGormDatastoreSpec { manyToOneBinder, columnNameForPropertyAndPathFetcher ) + ComponentBinder componentBinder = new ComponentBinder(binder.getMappingCacheHolder(), componentPropertyBinder) GrailsPropertyBinder propertyBinder = new GrailsPropertyBinder( metadataBuildingContext, namingStrategy, collectionHolder, enumTypeBinderToUse, - componentPropertyBinder, + componentBinder, collectionBinder, simpleValueBinder, columnNameForPropertyAndPathFetcher, @@ -432,7 +434,7 @@ class GrailsPropertyBinderSpec extends HibernateGormDatastoreSpec { // CollectionHolder is a Java record (final), so we instantiate it def collectionHolder = new org.grails.orm.hibernate.cfg.domainbinding.collectionType.CollectionHolder(new HashMap<Class<?>, org.grails.orm.hibernate.cfg.domainbinding.collectionType.CollectionType>()) def enumTypeBinder = Mock(EnumTypeBinder) - def componentPropertyBinder = Mock(ComponentPropertyBinder) + def componentBinder = Mock(ComponentBinder) def collectionBinder = Mock(CollectionBinder) def propertyFromValueCreator = Mock(PropertyFromValueCreator) def simpleValueBinder = Mock(SimpleValueBinder) @@ -446,7 +448,7 @@ class GrailsPropertyBinderSpec extends HibernateGormDatastoreSpec { namingStrategy, collectionHolder, enumTypeBinder, - componentPropertyBinder, + componentBinder, collectionBinder, simpleValueBinder, columnNameForPropertyAndPathFetcher, diff --git a/grails-data-hibernate7/core/src/test/groovy/org/grails/orm/hibernate/cfg/domainbinding/ListSecondPassBinderSpec.groovy b/grails-data-hibernate7/core/src/test/groovy/org/grails/orm/hibernate/cfg/domainbinding/ListSecondPassBinderSpec.groovy index d1fab3c61d..0bc9b88328 100644 --- a/grails-data-hibernate7/core/src/test/groovy/org/grails/orm/hibernate/cfg/domainbinding/ListSecondPassBinderSpec.groovy +++ b/grails-data-hibernate7/core/src/test/groovy/org/grails/orm/hibernate/cfg/domainbinding/ListSecondPassBinderSpec.groovy @@ -29,6 +29,7 @@ import org.grails.orm.hibernate.cfg.domainbinding.secondpass.ListSecondPassBinde import org.grails.orm.hibernate.cfg.domainbinding.binder.OneToOneBinder import org.grails.orm.hibernate.cfg.domainbinding.binder.ClassBinder +import org.grails.orm.hibernate.cfg.domainbinding.binder.ComponentBinder import org.grails.orm.hibernate.cfg.domainbinding.binder.ComponentPropertyBinder import org.grails.orm.hibernate.cfg.domainbinding.util.BasicValueIdCreator import org.grails.orm.hibernate.cfg.domainbinding.binder.GrailsPropertyBinder @@ -97,12 +98,13 @@ class ListSecondPassBinderSpec extends HibernateGormDatastoreSpec { manyToOneBinder, columnNameForPropertyAndPathFetcher ) + ComponentBinder componentBinder = new ComponentBinder(binder.getMappingCacheHolder(), componentPropertyBinder) GrailsPropertyBinder propertyBinder = new GrailsPropertyBinder( metadataBuildingContext, namingStrategy, collectionHolder, enumTypeBinderToUse, - componentPropertyBinder, + componentBinder, collectionBinder, simpleValueBinder, columnNameForPropertyAndPathFetcher, diff --git a/grails-data-hibernate7/core/src/test/groovy/org/grails/orm/hibernate/cfg/domainbinding/MapSecondPassBinderSpec.groovy b/grails-data-hibernate7/core/src/test/groovy/org/grails/orm/hibernate/cfg/domainbinding/MapSecondPassBinderSpec.groovy index 036c650430..bc546872b7 100644 --- a/grails-data-hibernate7/core/src/test/groovy/org/grails/orm/hibernate/cfg/domainbinding/MapSecondPassBinderSpec.groovy +++ b/grails-data-hibernate7/core/src/test/groovy/org/grails/orm/hibernate/cfg/domainbinding/MapSecondPassBinderSpec.groovy @@ -29,6 +29,7 @@ import org.grails.orm.hibernate.cfg.domainbinding.secondpass.MapSecondPassBinder import org.grails.orm.hibernate.cfg.domainbinding.binder.OneToOneBinder import org.grails.orm.hibernate.cfg.domainbinding.binder.ClassBinder +import org.grails.orm.hibernate.cfg.domainbinding.binder.ComponentBinder import org.grails.orm.hibernate.cfg.domainbinding.binder.ComponentPropertyBinder import org.grails.orm.hibernate.cfg.domainbinding.util.BasicValueIdCreator import org.grails.orm.hibernate.cfg.domainbinding.binder.GrailsPropertyBinder @@ -97,12 +98,13 @@ class MapSecondPassBinderSpec extends HibernateGormDatastoreSpec { manyToOneBinder, columnNameForPropertyAndPathFetcher ) + ComponentBinder componentBinder = new ComponentBinder(binder.getMappingCacheHolder(), componentPropertyBinder) GrailsPropertyBinder propertyBinder = new GrailsPropertyBinder( metadataBuildingContext, namingStrategy, collectionHolder, enumTypeBinderToUse, - componentPropertyBinder, + componentBinder, collectionBinder, simpleValueBinder, columnNameForPropertyAndPathFetcher,
