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 dba11c18b20d035f1575bd9a214dd8113a8466de Author: Walter Duque de Estrada <[email protected]> AuthorDate: Mon Feb 16 13:53:32 2026 -0600 Fix Enum mapping and refactor association binding in Hibernate 7 - Prioritize Enum detection in GrailsPropertyBinder and ComponentBinder to ensure correct binding. - Skip automatic type reflection for Enums in PropertyFromValueCreator to prevent overwriting custom Enum types. - Exclude Enums from cascade behavior checks in PropertyBinder to avoid MappingException. - Complete refactoring of CollectionBinder to encapsulate Hibernate Collection creation and registration. - Decouple ComponentBinder and GrailsPropertyBinder from CollectionHolder. - Update unit tests to align with new binder signatures and improved encapsulation. --- .../cfg/domainbinding/binder/ComponentBinder.java | 18 +++---------- .../domainbinding/binder/GrailsPropertyBinder.java | 18 +++---------- .../cfg/domainbinding/binder/PropertyBinder.java | 2 +- .../util/PropertyFromValueCreator.java | 4 ++- .../cfg/domainbinding/CollectionBinderSpec.groovy | 8 +++--- .../CollectionSecondPassBinderSpec.groovy | 8 +++--- .../cfg/domainbinding/ComponentBinderSpec.groovy | 30 +++++++--------------- .../cfg/domainbinding/CompositeIdBinderSpec.groovy | 2 +- .../domainbinding/GrailsPropertyBinderSpec.groovy | 6 ++--- .../domainbinding/ListSecondPassBinderSpec.groovy | 8 +++--- .../domainbinding/MapSecondPassBinderSpec.groovy | 8 +++--- 11 files changed, 36 insertions(+), 76 deletions(-) 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 34020c123c..8a773dff99 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 @@ -101,33 +101,23 @@ public class ComponentBinder { @Nonnull InFlightMetadataCollector mappings) { Value value; // work out what type of relationship it is and bind value - if (currentGrailsProp instanceof HibernateOneToOneProperty oneToOne) { + if (currentGrailsProp.isEnumType()) { + //HibernateEnumTypeProperty + value = enumTypeBinder.bindEnumType(currentGrailsProp, currentGrailsProp.getType(), table, path); + } else if (currentGrailsProp instanceof HibernateOneToOneProperty oneToOne) { //HibernateOneToOneProperty if (oneToOne.isHibernateOneToOne()) { - if (LOG.isDebugEnabled()) - LOG.debug("[GrailsDomainBinder] Binding property [" + currentGrailsProp.getName() + "] as OneToOne"); - value = oneToOneBinder.bindOneToOne((org.grails.datastore.mapping.model.types.OneToOne) currentGrailsProp, persistentClass, table, path); } else { - if (LOG.isDebugEnabled()) - LOG.debug("[GrailsDomainBinder] Binding property [" + currentGrailsProp.getName() + "] as ManyToOne"); - value = manyToOneBinder.bindManyToOne((Association) currentGrailsProp, table, path); } } else if (currentGrailsProp instanceof HibernateManyToOneProperty manyToOne) { - //HibernateManyToOneProperty - if (LOG.isDebugEnabled()) - LOG.debug("[GrailsDomainBinder] Binding property [" + currentGrailsProp.getName() + "] as ManyToOne"); - value = manyToOneBinder.bindManyToOne((Association) currentGrailsProp, table, path); } else if (currentGrailsProp instanceof HibernateToManyProperty toMany && !currentGrailsProp.isSerializableType()) { //HibernateToManyProperty value = collectionBinder.bindCollection(toMany, persistentClass, mappings, path); } else if (currentGrailsProp instanceof HibernateEmbeddedProperty embedded) { value = bindComponent(persistentClass, embedded, mappings); - } else if (currentGrailsProp instanceof HibernateBasicProperty basic && basic.isEnumType()) { - //HibernateEnumTypeProperty - value = enumTypeBinder.bindEnumType(currentGrailsProp, currentGrailsProp.getType(), table, path); } else { //HibernateSimpleProperty value = new BasicValue(metadataBuildingContext, table); 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 d2e402d4d6..dbda589d27 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 @@ -82,33 +82,23 @@ public class GrailsPropertyBinder { Value value = null; // 1. Create Value and apply binders (consolidated block) - if (currentGrailsProp instanceof HibernateOneToOneProperty oneToOne) { + if (currentGrailsProp.isEnumType()) { + //HibernateEnumTypeProperty + value = enumTypeBinder.bindEnumType(currentGrailsProp, currentGrailsProp.getType(), table, EMPTY_PATH); + } else if (currentGrailsProp instanceof HibernateOneToOneProperty oneToOne) { //HibernateOneToOneProperty if (oneToOne.isHibernateOneToOne()) { - if (LOG.isDebugEnabled()) - LOG.debug("[GrailsDomainBinder] Binding property [" + currentGrailsProp.getName() + "] as OneToOne"); - value = oneToOneBinder.bindOneToOne((org.grails.datastore.mapping.model.types.OneToOne) currentGrailsProp, persistentClass, table, EMPTY_PATH); } else { - if (LOG.isDebugEnabled()) - LOG.debug("[GrailsDomainBinder] Binding property [" + currentGrailsProp.getName() + "] as ManyToOne"); - value = manyToOneBinder.bindManyToOne((Association) currentGrailsProp, table, EMPTY_PATH); } } else if (currentGrailsProp instanceof HibernateManyToOneProperty manyToOne) { - //HibernateManyToOneProperty - if (LOG.isDebugEnabled()) - LOG.debug("[GrailsDomainBinder] Binding property [" + currentGrailsProp.getName() + "] as ManyToOne"); - value = manyToOneBinder.bindManyToOne((Association) currentGrailsProp, table, EMPTY_PATH); } else if (currentGrailsProp instanceof HibernateToManyProperty toMany && !currentGrailsProp.isSerializableType()) { //HibernateToManyProperty value = collectionBinder.bindCollection(toMany, persistentClass, mappings, EMPTY_PATH); } else if (currentGrailsProp instanceof HibernateEmbeddedProperty embedded) { value = componentBinder.bindComponent(persistentClass, embedded, mappings); - } else if (currentGrailsProp instanceof HibernateBasicProperty basic && basic.isEnumType()) { - //HibernateEnumTypeProperty - value = enumTypeBinder.bindEnumType(currentGrailsProp, currentGrailsProp.getType(), table, EMPTY_PATH); } else { //HibernateSimpleProperty value = new BasicValue(metadataBuildingContext, table); diff --git a/grails-data-hibernate7/core/src/main/groovy/org/grails/orm/hibernate/cfg/domainbinding/binder/PropertyBinder.java b/grails-data-hibernate7/core/src/main/groovy/org/grails/orm/hibernate/cfg/domainbinding/binder/PropertyBinder.java index 7552d05a08..47801bb157 100644 --- a/grails-data-hibernate7/core/src/main/groovy/org/grails/orm/hibernate/cfg/domainbinding/binder/PropertyBinder.java +++ b/grails-data-hibernate7/core/src/main/groovy/org/grails/orm/hibernate/cfg/domainbinding/binder/PropertyBinder.java @@ -67,7 +67,7 @@ public class PropertyBinder { prop.setOptional(persistentProperty.isNullable()); - if (persistentProperty instanceof Association<?> association) { + if (persistentProperty instanceof Association<?> association && !persistentProperty.isEnumType()) { prop.setCascade(cascadeBehaviorFetcher.getCascadeBehaviour(association)); } diff --git a/grails-data-hibernate7/core/src/main/groovy/org/grails/orm/hibernate/cfg/domainbinding/util/PropertyFromValueCreator.java b/grails-data-hibernate7/core/src/main/groovy/org/grails/orm/hibernate/cfg/domainbinding/util/PropertyFromValueCreator.java index 7a6b51ba50..c00f419438 100644 --- a/grails-data-hibernate7/core/src/main/groovy/org/grails/orm/hibernate/cfg/domainbinding/util/PropertyFromValueCreator.java +++ b/grails-data-hibernate7/core/src/main/groovy/org/grails/orm/hibernate/cfg/domainbinding/util/PropertyFromValueCreator.java @@ -20,7 +20,9 @@ public class PropertyFromValueCreator { public Property createProperty(Value value, GrailsHibernatePersistentProperty grailsProperty) { // set type - value.setTypeUsingReflection(grailsProperty.getOwnerClassName(), grailsProperty.getName()); + if (!grailsProperty.isEnumType()) { + value.setTypeUsingReflection(grailsProperty.getOwnerClassName(), grailsProperty.getName()); + } if (value.getTable() != null) { value.createForeignKey(); 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 06cf7dff8b..d472456e5d 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 @@ -77,14 +77,14 @@ class CollectionBinderSpec extends HibernateGormDatastoreSpec { manyToOneBinder, compositeIdentifierToManyToOneBinder, simpleValueColumnFetcher, - columnNameForPropertyAndPathFetcher + columnNameForPropertyAndPathFetcher, + collectionHolder ) PropertyFromValueCreator propertyFromValueCreator = new PropertyFromValueCreator() ComponentUpdater componentUpdater = new ComponentUpdater(propertyFromValueCreator) ComponentBinder componentBinder = new ComponentBinder( metadataBuildingContext, binder.getMappingCacheHolder(), - collectionHolder, enumTypeBinderToUse, collectionBinder, simpleValueBinder, @@ -97,7 +97,6 @@ class CollectionBinderSpec extends HibernateGormDatastoreSpec { GrailsPropertyBinder propertyBinder = new GrailsPropertyBinder( metadataBuildingContext, namingStrategy, - collectionHolder, enumTypeBinderToUse, componentBinder, collectionBinder, @@ -172,10 +171,9 @@ class CollectionBinderSpec extends HibernateGormDatastoreSpec { rootClass.setTable(collector.addTable(null, null, "PERSON", null, false, binder.getMetadataBuildingContext())) def petsProp = personEntity.getPropertyByName("pets") as GrailsHibernatePersistentProperty - def collection = new Set(binder.getMetadataBuildingContext(), rootClass) when: - collectionBinder.bindCollection(petsProp, collection, rootClass, collector, "") + def collection = collectionBinder.bindCollection(petsProp, rootClass, collector, "") then: collection.role == "${personEntity.name}.pets".toString() 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 6f5407545b..f7e5ff344f 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 @@ -76,14 +76,14 @@ class CollectionSecondPassBinderSpec extends HibernateGormDatastoreSpec { manyToOneBinder, compositeIdentifierToManyToOneBinder, simpleValueColumnFetcher, - columnNameForPropertyAndPathFetcher + columnNameForPropertyAndPathFetcher, + collectionHolder ) PropertyFromValueCreator propertyFromValueCreator = new PropertyFromValueCreator() ComponentUpdater componentUpdater = new ComponentUpdater(propertyFromValueCreator) ComponentBinder componentBinder = new ComponentBinder( metadataBuildingContext, binder.getMappingCacheHolder(), - collectionHolder, enumTypeBinderToUse, collectionBinder, simpleValueBinder, @@ -96,7 +96,6 @@ class CollectionSecondPassBinderSpec extends HibernateGormDatastoreSpec { GrailsPropertyBinder propertyBinder = new GrailsPropertyBinder( metadataBuildingContext, namingStrategy, - collectionHolder, enumTypeBinderToUse, componentBinder, collectionBinder, @@ -171,10 +170,9 @@ class CollectionSecondPassBinderSpec extends HibernateGormDatastoreSpec { rootClass.setTable(collector.addTable(null, null, "PERSON", null, false, binder.getMetadataBuildingContext())) def petsProp = personEntity.getPropertyByName("pets") as GrailsHibernatePersistentProperty - def collection = new Set(binder.getMetadataBuildingContext(), rootClass) when: - collectionBinder.bindCollection(petsProp, collection, rootClass, collector, "") + def collection = collectionBinder.bindCollection(petsProp, rootClass, collector, "") then: collection.role == "${personEntity.name}.pets".toString() diff --git a/grails-data-hibernate7/core/src/test/groovy/org/grails/orm/hibernate/cfg/domainbinding/ComponentBinderSpec.groovy b/grails-data-hibernate7/core/src/test/groovy/org/grails/orm/hibernate/cfg/domainbinding/ComponentBinderSpec.groovy index b705a574ce..62e2571af4 100644 --- a/grails-data-hibernate7/core/src/test/groovy/org/grails/orm/hibernate/cfg/domainbinding/ComponentBinderSpec.groovy +++ b/grails-data-hibernate7/core/src/test/groovy/org/grails/orm/hibernate/cfg/domainbinding/ComponentBinderSpec.groovy @@ -93,11 +93,9 @@ class ComponentBinderSpec extends HibernateGormDatastoreSpec { def setup() { def metadataBuildingContext = getGrailsDomainBinder().getMetadataBuildingContext() - collectionHolder = new CollectionHolder(metadataBuildingContext) binder = new ComponentBinder( metadataBuildingContext, mappingCacheHolder, - collectionHolder, enumTypeBinder, collectionBinder, mockSimpleValueBinder, @@ -245,7 +243,6 @@ class ComponentBinderSpec extends HibernateGormDatastoreSpec { given: def metadataBuildingContext = getGrailsDomainBinder().getMetadataBuildingContext() def root = new RootClass(metadataBuildingContext) - def component = new Component(metadataBuildingContext, root) def table = new Table("my_table") def ownerEntity = Mock(GrailsHibernatePersistentEntity) ownerEntity.isRoot() >> true @@ -266,7 +263,7 @@ class ComponentBinderSpec extends HibernateGormDatastoreSpec { setupProperty(componentProperty, "address", mapping, ownerEntity) when: - binder.bindComponentProperty(component, componentProperty, currentGrailsProp, root, "address", table, mappings) + binder.bindComponentProperty(componentProperty, currentGrailsProp, root, "address", table, mappings) then: 1 * mockSimpleValueBinder.bindSimpleValue(currentGrailsProp, componentProperty, _ as BasicValue, "address") @@ -277,7 +274,6 @@ class ComponentBinderSpec extends HibernateGormDatastoreSpec { given: def metadataBuildingContext = getGrailsDomainBinder().getMetadataBuildingContext() def root = new RootClass(metadataBuildingContext) - def component = new Component(metadataBuildingContext, root) def table = new Table("my_table") def ownerEntity = Mock(GrailsHibernatePersistentEntity) ownerEntity.isRoot() >> true @@ -302,7 +298,7 @@ class ComponentBinderSpec extends HibernateGormDatastoreSpec { setupProperty(componentProperty, "address", mapping, ownerEntity) when: - binder.bindComponentProperty(component, componentProperty, currentGrailsProp, root, "address", table, mappings) + binder.bindComponentProperty(componentProperty, currentGrailsProp, root, "address", table, mappings) then: 1 * manyToOneBinder.bindManyToOne(currentGrailsProp, table, "address") >> hibernateManyToOne @@ -313,7 +309,6 @@ class ComponentBinderSpec extends HibernateGormDatastoreSpec { given: def metadataBuildingContext = getGrailsDomainBinder().getMetadataBuildingContext() def root = new RootClass(metadataBuildingContext) - def component = new Component(metadataBuildingContext, root) def table = new Table("my_table") def ownerEntity = Mock(GrailsHibernatePersistentEntity) ownerEntity.isRoot() >> true @@ -341,7 +336,7 @@ class ComponentBinderSpec extends HibernateGormDatastoreSpec { def hibernateOneToOne = new HibernateOneToOne(metadataBuildingContext, table, root) when: - binder.bindComponentProperty(component, componentProperty, currentGrailsProp, root, "address", table, mappings) + binder.bindComponentProperty(componentProperty, currentGrailsProp, root, "address", table, mappings) then: 1 * oneToOneBinder.bindOneToOne(currentGrailsProp, root, table, "address") >> hibernateOneToOne @@ -352,7 +347,6 @@ class ComponentBinderSpec extends HibernateGormDatastoreSpec { given: def metadataBuildingContext = getGrailsDomainBinder().getMetadataBuildingContext() def root = new RootClass(metadataBuildingContext) - def component = new Component(metadataBuildingContext, root) def table = new Table("my_table") def ownerEntity = Mock(GrailsHibernatePersistentEntity) ownerEntity.isRoot() >> true @@ -374,7 +368,7 @@ class ComponentBinderSpec extends HibernateGormDatastoreSpec { columnNameFetcher.getColumnNameForPropertyAndPath(currentGrailsProp, "address", null) >> "address_type_col" when: - binder.bindComponentProperty(component, componentProperty, currentGrailsProp, root, "address", table, mappings) + binder.bindComponentProperty(componentProperty, currentGrailsProp, root, "address", table, mappings) then: 1 * enumTypeBinder.bindEnumType(currentGrailsProp, MyEnum, table, "address") @@ -385,7 +379,6 @@ class ComponentBinderSpec extends HibernateGormDatastoreSpec { given: def metadataBuildingContext = getGrailsDomainBinder().getMetadataBuildingContext() def root = new RootClass(metadataBuildingContext) - def component = new Component(metadataBuildingContext, root) def table = new Table("my_table") def ownerEntity = Mock(GrailsHibernatePersistentEntity) ownerEntity.isRoot() >> true @@ -406,7 +399,7 @@ class ComponentBinderSpec extends HibernateGormDatastoreSpec { ownerEntity.isComponentPropertyNullable(componentProperty) >> true when: - binder.bindComponentProperty(component, componentProperty, currentGrailsProp, root, "address", table, mappings) + binder.bindComponentProperty(componentProperty, currentGrailsProp, root, "address", table, mappings) then: 1 * mockSimpleValueBinder.bindSimpleValue( @@ -422,7 +415,6 @@ class ComponentBinderSpec extends HibernateGormDatastoreSpec { given: def metadataBuildingContext = getGrailsDomainBinder().getMetadataBuildingContext() def root = new RootClass(metadataBuildingContext) - def component = new Component(metadataBuildingContext, root) def table = new Table("my_table") def currentGrailsProp = Mock(org.grails.orm.hibernate.cfg.domainbinding.hibernate.HibernateToManyProperty) def componentProperty = Mock(GrailsHibernatePersistentProperty) @@ -433,12 +425,10 @@ class ComponentBinderSpec extends HibernateGormDatastoreSpec { currentGrailsProp.isHibernateManyToOne() >> false when: - def result = binder.bindComponentProperty(component, componentProperty, currentGrailsProp, root, "address", table, mappings) + def result = binder.bindComponentProperty(componentProperty, currentGrailsProp, root, "address", table, mappings) then: - result instanceof org.hibernate.mapping.Set - 1 * collectionBinder.bindCollection(currentGrailsProp, _ as org.hibernate.mapping.Set, root, mappings, "address") - 1 * mappings.addCollectionBinding(_ as org.hibernate.mapping.Set) + 1 * collectionBinder.bindCollection(currentGrailsProp, root, mappings, "address") >> Mock(org.hibernate.mapping.Set) } def "should bind nested component recursively"() { @@ -446,7 +436,6 @@ class ComponentBinderSpec extends HibernateGormDatastoreSpec { def metadataBuildingContext = getGrailsDomainBinder().getMetadataBuildingContext() def root = new RootClass(metadataBuildingContext) root.setTable(new Table("my_table")) - def component = new Component(metadataBuildingContext, root) def table = root.getTable() def mappings = Mock(InFlightMetadataCollector) @@ -473,7 +462,7 @@ class ComponentBinderSpec extends HibernateGormDatastoreSpec { nestedAssociatedEntity.getIdentity() >> null when: - def result = binder.bindComponentProperty(component, parentProp, nestedEmbeddedProp, root, "address.nested", table, mappings) + def result = binder.bindComponentProperty(parentProp, nestedEmbeddedProp, root, "address.nested", table, mappings) then: result instanceof Component @@ -487,7 +476,6 @@ class ComponentBinderSpec extends HibernateGormDatastoreSpec { given: def metadataBuildingContext = getGrailsDomainBinder().getMetadataBuildingContext() def root = new RootClass(metadataBuildingContext) - def component = new Component(metadataBuildingContext, root) def table = new Table("my_table") def currentGrailsProp = Mock(TestOneToOne) def componentProperty = Mock(GrailsHibernatePersistentProperty) @@ -500,7 +488,7 @@ class ComponentBinderSpec extends HibernateGormDatastoreSpec { def hibernateManyToOne = new HibernateManyToOne(metadataBuildingContext, table) when: - def result = binder.bindComponentProperty(component, componentProperty, currentGrailsProp, root, "address", table, mappings) + def result = binder.bindComponentProperty(componentProperty, currentGrailsProp, root, "address", table, mappings) then: 1 * manyToOneBinder.bindManyToOne(currentGrailsProp, table, "address") >> hibernateManyToOne diff --git a/grails-data-hibernate7/core/src/test/groovy/org/grails/orm/hibernate/cfg/domainbinding/CompositeIdBinderSpec.groovy b/grails-data-hibernate7/core/src/test/groovy/org/grails/orm/hibernate/cfg/domainbinding/CompositeIdBinderSpec.groovy index 6a3f3aaf53..e243472a15 100644 --- a/grails-data-hibernate7/core/src/test/groovy/org/grails/orm/hibernate/cfg/domainbinding/CompositeIdBinderSpec.groovy +++ b/grails-data-hibernate7/core/src/test/groovy/org/grails/orm/hibernate/cfg/domainbinding/CompositeIdBinderSpec.groovy @@ -56,7 +56,7 @@ class CompositeIdBinderSpec extends HibernateGormDatastoreSpec { root.getIdentifier() instanceof Component root.getIdentifierMapper() instanceof Component root.hasEmbeddedIdentifier() - 2 * componentBinder.bindComponentProperty(_ as Component, identifierProp, _ as PersistentProperty, root, "", table, mappings) >> Mock(Value) + 2 * componentBinder.bindComponentProperty(identifierProp, _ as PersistentProperty, root, "", table, mappings) >> Mock(Value) 2 * componentUpdater.updateComponent(_ as Component, identifierProp, _ as PersistentProperty, _ as Value) } 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 77409b4922..8a5ef930db 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 @@ -135,14 +135,14 @@ class GrailsPropertyBinderSpec extends HibernateGormDatastoreSpec { manyToOneBinder, compositeIdentifierToManyToOneBinder, simpleValueColumnFetcher, - columnNameForPropertyAndPathFetcher + columnNameForPropertyAndPathFetcher, + collectionHolder ) PropertyFromValueCreator propertyFromValueCreator = new PropertyFromValueCreator() ComponentUpdater componentUpdater = new ComponentUpdater(propertyFromValueCreator) ComponentBinder componentBinder = new ComponentBinder( metadataBuildingContext, binder.getMappingCacheHolder(), - collectionHolder, enumTypeBinderToUse, collectionBinder, simpleValueBinder, @@ -154,7 +154,6 @@ class GrailsPropertyBinderSpec extends HibernateGormDatastoreSpec { GrailsPropertyBinder propertyBinder = new GrailsPropertyBinder( metadataBuildingContext, namingStrategy, - collectionHolder, enumTypeBinderToUse, componentBinder, collectionBinder, @@ -504,7 +503,6 @@ class GrailsPropertyBinderSpec extends HibernateGormDatastoreSpec { def propertyBinder = new GrailsPropertyBinder( metadataBuildingContext, namingStrategy, - collectionHolder, enumTypeBinder, componentBinder, collectionBinder, 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 bf981f2753..5dde40379c 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 @@ -76,14 +76,14 @@ class ListSecondPassBinderSpec extends HibernateGormDatastoreSpec { manyToOneBinder, compositeIdentifierToManyToOneBinder, simpleValueColumnFetcher, - columnNameForPropertyAndPathFetcher + columnNameForPropertyAndPathFetcher, + collectionHolder ) PropertyFromValueCreator propertyFromValueCreator = new PropertyFromValueCreator() ComponentUpdater componentUpdater = new ComponentUpdater(propertyFromValueCreator) ComponentBinder componentBinder = new ComponentBinder( metadataBuildingContext, binder.getMappingCacheHolder(), - collectionHolder, enumTypeBinderToUse, collectionBinder, simpleValueBinder, @@ -96,7 +96,6 @@ class ListSecondPassBinderSpec extends HibernateGormDatastoreSpec { GrailsPropertyBinder propertyBinder = new GrailsPropertyBinder( metadataBuildingContext, namingStrategy, - collectionHolder, enumTypeBinderToUse, componentBinder, collectionBinder, @@ -171,10 +170,9 @@ class ListSecondPassBinderSpec extends HibernateGormDatastoreSpec { rootClass.setTable(collector.addTable(null, null, "PERSON", null, false, binder.getMetadataBuildingContext())) def petsProp = personEntity.getPropertyByName("pets") as GrailsHibernatePersistentProperty - def collection = new Set(binder.getMetadataBuildingContext(), rootClass) when: - collectionBinder.bindCollection(petsProp, collection, rootClass, collector, "") + def collection = collectionBinder.bindCollection(petsProp, rootClass, collector, "") then: collection.role == "${personEntity.name}.pets".toString() 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 6c17a3e478..026943763d 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 @@ -76,14 +76,14 @@ class MapSecondPassBinderSpec extends HibernateGormDatastoreSpec { manyToOneBinder, compositeIdentifierToManyToOneBinder, simpleValueColumnFetcher, - columnNameForPropertyAndPathFetcher + columnNameForPropertyAndPathFetcher, + collectionHolder ) PropertyFromValueCreator propertyFromValueCreator = new PropertyFromValueCreator() ComponentUpdater componentUpdater = new ComponentUpdater(propertyFromValueCreator) ComponentBinder componentBinder = new ComponentBinder( metadataBuildingContext, binder.getMappingCacheHolder(), - collectionHolder, enumTypeBinderToUse, collectionBinder, simpleValueBinder, @@ -96,7 +96,6 @@ class MapSecondPassBinderSpec extends HibernateGormDatastoreSpec { GrailsPropertyBinder propertyBinder = new GrailsPropertyBinder( metadataBuildingContext, namingStrategy, - collectionHolder, enumTypeBinderToUse, componentBinder, collectionBinder, @@ -171,10 +170,9 @@ class MapSecondPassBinderSpec extends HibernateGormDatastoreSpec { rootClass.setTable(collector.addTable(null, null, "PERSON", null, false, binder.getMetadataBuildingContext())) def petsProp = personEntity.getPropertyByName("pets") as GrailsHibernatePersistentProperty - def collection = new Set(binder.getMetadataBuildingContext(), rootClass) when: - collectionBinder.bindCollection(petsProp, collection, rootClass, collector, "") + def collection = collectionBinder.bindCollection(petsProp, rootClass, collector, "") then: collection.role == "${personEntity.name}.pets".toString()
