This is an automated email from the ASF dual-hosted git repository. borinquenkid pushed a commit to branch 8.0.x-hibernate7-dev in repository https://gitbox.apache.org/repos/asf/grails-core.git
commit e7fb13f57745104760014d4d453e22525e908b99 Author: Walter Duque de Estrada <[email protected]> AuthorDate: Mon Mar 16 13:10:02 2026 -0500 hibernate 7 temp --- .../hibernate/cfg/domainbinding/binder/CollectionBinder.java | 11 ++++------- .../cfg/domainbinding/binder/GrailsPropertyBinder.java | 2 +- .../cfg/domainbinding/collectionType/CollectionType.java | 1 - .../hibernate/cfg/domainbinding/CollectionBinderSpec.groovy | 2 +- .../domainbinding/secondpass/ListSecondPassBinderSpec.groovy | 7 ++----- 5 files changed, 8 insertions(+), 15 deletions(-) diff --git a/grails-data-hibernate7/core/src/main/groovy/org/grails/orm/hibernate/cfg/domainbinding/binder/CollectionBinder.java b/grails-data-hibernate7/core/src/main/groovy/org/grails/orm/hibernate/cfg/domainbinding/binder/CollectionBinder.java index 148a4cdf29..aec228086e 100644 --- a/grails-data-hibernate7/core/src/main/groovy/org/grails/orm/hibernate/cfg/domainbinding/binder/CollectionBinder.java +++ b/grails-data-hibernate7/core/src/main/groovy/org/grails/orm/hibernate/cfg/domainbinding/binder/CollectionBinder.java @@ -32,7 +32,6 @@ import org.grails.orm.hibernate.cfg.PersistentEntityNamingStrategy; import org.grails.orm.hibernate.cfg.PropertyConfig; import org.grails.orm.hibernate.cfg.domainbinding.collectionType.CollectionHolder; import org.grails.orm.hibernate.cfg.domainbinding.collectionType.CollectionType; -import org.grails.orm.hibernate.cfg.domainbinding.hibernate.GrailsHibernatePersistentEntity; import org.grails.orm.hibernate.cfg.domainbinding.hibernate.HibernateOneToManyProperty; import org.grails.orm.hibernate.cfg.domainbinding.hibernate.HibernatePersistentProperty; import org.grails.orm.hibernate.cfg.domainbinding.hibernate.HibernateToManyProperty; @@ -135,20 +134,18 @@ public class CollectionBinder { * First pass to bind collection to Hibernate metamodel, sets up second pass * * @param property The GrailsDomainClassProperty instance - * @param persistentClass The owning persistent class - * @param path The property path + * @param path The property path * @return the result */ - public Collection bindCollection(HibernateToManyProperty property, PersistentClass persistentClass, String path) { - GrailsHibernatePersistentEntity owner = property.getHibernateOwner(); - PersistentClass _persistentClass = owner.getPersistentClass(); + public Collection bindCollection(HibernateToManyProperty property, String path) { + PersistentClass _persistentClass = property.getHibernateOwner().getPersistentClass(); CollectionType collectionType = collectionHolder.get(property.getType()); Collection collection = collectionType.create(property, _persistentClass); property.setCollection(collection); // set role String propertyName = getNameForPropertyAndPath(property, path); - collection.setRole(GrailsHibernateUtil.qualify(owner.getName(), propertyName)); + collection.setRole(GrailsHibernateUtil.qualify(property.getHibernateOwner().getName(), propertyName)); PropertyConfig pc = property.getMappedForm(); // configure eager fetching 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 d7577fd1b8..a409764173 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 @@ -85,7 +85,7 @@ public class GrailsPropertyBinder { value = manyToOneBinder.bindManyToOne(manyToOne, table, path); } else if (currentGrailsProp instanceof HibernateToManyProperty toMany && !currentGrailsProp.isSerializableType()) { - value = collectionBinder.bindCollection(toMany, persistentClass, path); + value = collectionBinder.bindCollection(toMany, path); } else if (currentGrailsProp instanceof HibernateEmbeddedProperty embedded) { value = componentBinder.bindComponent(persistentClass, embedded, path); } else { diff --git a/grails-data-hibernate7/core/src/main/groovy/org/grails/orm/hibernate/cfg/domainbinding/collectionType/CollectionType.java b/grails-data-hibernate7/core/src/main/groovy/org/grails/orm/hibernate/cfg/domainbinding/collectionType/CollectionType.java index add61d72d5..fc0963f3c3 100644 --- a/grails-data-hibernate7/core/src/main/groovy/org/grails/orm/hibernate/cfg/domainbinding/collectionType/CollectionType.java +++ b/grails-data-hibernate7/core/src/main/groovy/org/grails/orm/hibernate/cfg/domainbinding/collectionType/CollectionType.java @@ -43,7 +43,6 @@ public abstract class CollectionType { /** Create. */ public Collection create(HibernateToManyProperty property, PersistentClass owner) throws MappingException { - property.getPersistentClass(); Collection coll = createCollection(owner); coll.setCollectionTable(owner.getTable()); coll.setTypeName(getTypeName(property)); 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 4559ff1323..a4725a8433 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 @@ -176,7 +176,7 @@ class CollectionBinderSpec extends HibernateGormDatastoreSpec { def petsProp = personEntity.getPropertyByName("pets") as HibernateToManyProperty when: - def collection = collectionBinder.bindCollection(petsProp, rootClass, "") + def collection = collectionBinder.bindCollection(petsProp, "") then: collection.role == "${personEntity.name}.pets".toString() diff --git a/grails-data-hibernate7/core/src/test/groovy/org/grails/orm/hibernate/cfg/domainbinding/secondpass/ListSecondPassBinderSpec.groovy b/grails-data-hibernate7/core/src/test/groovy/org/grails/orm/hibernate/cfg/domainbinding/secondpass/ListSecondPassBinderSpec.groovy index 5cddb03857..05bb1e0fa8 100644 --- a/grails-data-hibernate7/core/src/test/groovy/org/grails/orm/hibernate/cfg/domainbinding/secondpass/ListSecondPassBinderSpec.groovy +++ b/grails-data-hibernate7/core/src/test/groovy/org/grails/orm/hibernate/cfg/domainbinding/secondpass/ListSecondPassBinderSpec.groovy @@ -1,12 +1,9 @@ package org.grails.orm.hibernate.cfg.domainbinding.secondpass import grails.gorm.specs.HibernateGormDatastoreSpec -import org.grails.orm.hibernate.cfg.PersistentEntityNamingStrategy -import org.grails.orm.hibernate.cfg.domainbinding.binder.SimpleValueColumnBinder import org.grails.orm.hibernate.cfg.domainbinding.hibernate.GrailsHibernatePersistentEntity import org.grails.orm.hibernate.cfg.domainbinding.hibernate.HibernateToManyProperty -import org.hibernate.boot.spi.InFlightMetadataCollector -import org.hibernate.boot.spi.MetadataBuildingContext + import org.hibernate.mapping.OneToMany import org.hibernate.mapping.RootClass import org.hibernate.boot.spi.MetadataBuildingContext @@ -179,7 +176,7 @@ class ListSecondPassBinderSpec extends HibernateGormDatastoreSpec { def petsProp = personEntity.getPropertyByName("pets") as HibernateToManyProperty when: - def collection = collectionBinder.bindCollection(petsProp, rootClass, "") + def collection = collectionBinder.bindCollection(petsProp, "") then: collection.role == "${personEntity.name}.pets".toString()
