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 010ec2fee5e69981cbeb45447144f5af275441ff Author: Walter Duque de Estrada <[email protected]> AuthorDate: Thu Feb 5 20:47:24 2026 -0600 removing ununsed argumentd --- .../hibernate/cfg/domainbinding/CollectionBinder.java | 13 ++++++------- .../cfg/domainbinding/ComponentPropertyBinder.java | 14 ++------------ .../cfg/domainbinding/GrailsPropertyBinder.java | 11 ++++------- .../cfg/domainbinding/TableForManyCalculator.java | 3 +-- .../domainbinding/collectionType/CollectionType.java | 18 +----------------- .../domainbinding/TableForManyCalculatorSpec.groovy | 5 ++--- .../collectionType/BagCollectionTypeSpec.groovy | 2 +- .../collectionType/ListCollectionTypeSpec.groovy | 2 +- .../collectionType/MapCollectionTypeSpec.groovy | 2 +- .../collectionType/SetCollectionTypeSpec.groovy | 2 +- .../collectionType/SortedSetCollectionTypeSpec.groovy | 2 +- 11 files changed, 21 insertions(+), 53 deletions(-) diff --git a/grails-data-hibernate7/core/src/main/groovy/org/grails/orm/hibernate/cfg/domainbinding/CollectionBinder.java b/grails-data-hibernate7/core/src/main/groovy/org/grails/orm/hibernate/cfg/domainbinding/CollectionBinder.java index 56d3d145e1..989befa998 100644 --- a/grails-data-hibernate7/core/src/main/groovy/org/grails/orm/hibernate/cfg/domainbinding/CollectionBinder.java +++ b/grails-data-hibernate7/core/src/main/groovy/org/grails/orm/hibernate/cfg/domainbinding/CollectionBinder.java @@ -36,7 +36,6 @@ import org.hibernate.mapping.Collection; import org.hibernate.mapping.Column; import org.hibernate.mapping.Component; import org.hibernate.mapping.DependantValue; -import org.hibernate.mapping.Formula; import org.hibernate.mapping.IndexBackref; import org.hibernate.mapping.IndexedCollection; import org.hibernate.mapping.KeyValue; @@ -123,7 +122,7 @@ public class CollectionBinder { collection.setElement(oneToMany); bindOneToMany((org.grails.datastore.mapping.model.types.OneToMany) property, oneToMany, mappings); } else { - bindCollectionTable(property, mappings, collection, owner.getTable(), sessionFactoryBeanName); + bindCollectionTable(property, mappings, collection, owner.getTable()); if (!property.isOwningSide()) { collection.setInverse(true); @@ -320,7 +319,7 @@ public class CollectionBinder { bindCollectionSecondPass(property, mappings, persistentClasses, list, sessionFactoryBeanName); - String columnName = getIndexColumnName(property, sessionFactoryBeanName); + String columnName = getIndexColumnName(property); final boolean isManyToMany = property instanceof ManyToMany; if (isManyToMany && !property.isOwningSide()) { @@ -401,7 +400,7 @@ public class CollectionBinder { SimpleValue value = new BasicValue(metadataBuildingContext, map.getCollectionTable()); String type = ((GrailsHibernatePersistentProperty) property).getIndexColumnType("string"); - String columnName1 = getIndexColumnName(property, sessionFactoryBeanName); + String columnName1 = getIndexColumnName(property); new SimpleValueColumnBinder().bindSimpleValue(value, type, columnName1, true); PropertyConfig mappedForm = property.getMappedForm(); if (mappedForm.getIndexColumn() != null) { @@ -480,13 +479,13 @@ public class CollectionBinder { } private void bindCollectionTable(HibernateToManyProperty property, @Nonnull InFlightMetadataCollector mappings, - Collection collection, Table ownerTable, String sessionFactoryBeanName) { + Collection collection, Table ownerTable) { String owningTableSchema = ownerTable.getSchema(); PropertyConfig config = property.getMappedForm(); JoinTable jt = config.getJoinTable(); - String s = new TableForManyCalculator(namingStrategy).calculateTableForMany(property, sessionFactoryBeanName); + String s = new TableForManyCalculator(namingStrategy).calculateTableForMany(property); String tableName = (jt != null && jt.getName() != null ? jt.getName() : namingStrategy.resolveTableName(s)); String schemaName = new NamespaceNameExtractor().getSchemaName(mappings); @@ -509,7 +508,7 @@ public class CollectionBinder { tableName, null, false, metadataBuildingContext)); } - private String getIndexColumnName(PersistentProperty property, String sessionFactoryBeanName) { + private String getIndexColumnName(PersistentProperty property) { PropertyConfig pc = property instanceof GrailsHibernatePersistentProperty ghpp ? ghpp.getMappedForm() : new PropertyConfig(); if (pc.getIndexColumn() != null && pc.getIndexColumn().getColumn() != null) { return pc.getIndexColumn().getColumn(); diff --git a/grails-data-hibernate7/core/src/main/groovy/org/grails/orm/hibernate/cfg/domainbinding/ComponentPropertyBinder.java b/grails-data-hibernate7/core/src/main/groovy/org/grails/orm/hibernate/cfg/domainbinding/ComponentPropertyBinder.java index 04f808f8a7..7d13e431a2 100644 --- a/grails-data-hibernate7/core/src/main/groovy/org/grails/orm/hibernate/cfg/domainbinding/ComponentPropertyBinder.java +++ b/grails-data-hibernate7/core/src/main/groovy/org/grails/orm/hibernate/cfg/domainbinding/ComponentPropertyBinder.java @@ -1,9 +1,7 @@ package org.grails.orm.hibernate.cfg.domainbinding; import java.util.Iterator; -import java.util.List; -import org.hibernate.FetchMode; import org.hibernate.boot.spi.InFlightMetadataCollector; import org.hibernate.boot.spi.MetadataBuildingContext; import org.hibernate.mapping.BasicValue; @@ -17,30 +15,22 @@ import org.hibernate.mapping.Property; import org.hibernate.mapping.SimpleValue; import org.hibernate.mapping.Table; import org.hibernate.mapping.Value; -import org.hibernate.type.ForeignKeyDirection; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import org.grails.datastore.mapping.model.PersistentEntity; import org.grails.datastore.mapping.model.PersistentProperty; -import org.grails.datastore.mapping.model.config.GormProperties; import org.grails.datastore.mapping.model.types.Association; import org.grails.datastore.mapping.model.types.Embedded; import org.grails.orm.hibernate.cfg.GrailsHibernatePersistentEntity; import org.grails.orm.hibernate.cfg.GrailsHibernatePersistentProperty; -import org.grails.orm.hibernate.cfg.GrailsHibernateUtil; import org.grails.orm.hibernate.cfg.HibernateToManyProperty; -import org.grails.orm.hibernate.cfg.Mapping; import org.grails.orm.hibernate.cfg.MappingCacheHolder; 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 jakarta.annotation.Nonnull; -import static org.grails.orm.hibernate.cfg.GrailsDomainBinder.EMPTY_PATH; - public class ComponentPropertyBinder { private static final Logger LOG = LoggerFactory.getLogger(ComponentPropertyBinder.class); @@ -102,8 +92,8 @@ public class ComponentPropertyBinder { CollectionType collectionType = collectionHolder.get(currentGrailsProp.getType()); if (collectionType != null) { // create collection - Collection collection = collectionType.create((HibernateToManyProperty) currentGrailsProp, persistentClass, - path, mappings, sessionFactoryBeanName); + Collection collection = collectionType.create((HibernateToManyProperty) currentGrailsProp, persistentClass + ); collectionBinder.bindCollection((HibernateToManyProperty) currentGrailsProp, collection, persistentClass, mappings, path, sessionFactoryBeanName); mappings.addCollectionBinding(collection); value = collection; diff --git a/grails-data-hibernate7/core/src/main/groovy/org/grails/orm/hibernate/cfg/domainbinding/GrailsPropertyBinder.java b/grails-data-hibernate7/core/src/main/groovy/org/grails/orm/hibernate/cfg/domainbinding/GrailsPropertyBinder.java index e1503724b1..12bcf99a15 100644 --- a/grails-data-hibernate7/core/src/main/groovy/org/grails/orm/hibernate/cfg/domainbinding/GrailsPropertyBinder.java +++ b/grails-data-hibernate7/core/src/main/groovy/org/grails/orm/hibernate/cfg/domainbinding/GrailsPropertyBinder.java @@ -21,7 +21,6 @@ import org.hibernate.mapping.Property; import org.hibernate.mapping.SimpleValue; import org.hibernate.mapping.Table; import org.hibernate.mapping.Value; -import org.hibernate.usertype.UserCollectionType; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -118,8 +117,8 @@ public class GrailsPropertyBinder { simpleValueBinder.bindSimpleValue(currentGrailsProp, null,(SimpleValue) value, EMPTY_PATH);// No specific binder call needed } else { // Actual Collection - Collection collection = collectionType.create((HibernateToManyProperty) currentGrailsProp, persistentClass, - EMPTY_PATH, mappings, sessionFactoryBeanName); + Collection collection = collectionType.create((HibernateToManyProperty) currentGrailsProp, persistentClass + ); collectionBinder.bindCollection((HibernateToManyProperty) currentGrailsProp, collection, persistentClass, mappings, EMPTY_PATH, sessionFactoryBeanName); mappings.addCollectionBinding(collection); value = collection; @@ -155,9 +154,7 @@ public class GrailsPropertyBinder { // After creating the value and applying binders (where applicable), create and add the property. // This is now done once at the end of the consolidated block. - if (value != null) { - Property property = propertyFromValueCreator.createProperty(value, currentGrailsProp); - persistentClass.addProperty(property); - } + Property property = propertyFromValueCreator.createProperty(value, currentGrailsProp); + persistentClass.addProperty(property); } } \ No newline at end of file diff --git a/grails-data-hibernate7/core/src/main/groovy/org/grails/orm/hibernate/cfg/domainbinding/TableForManyCalculator.java b/grails-data-hibernate7/core/src/main/groovy/org/grails/orm/hibernate/cfg/domainbinding/TableForManyCalculator.java index d48696e96e..44f253f314 100644 --- a/grails-data-hibernate7/core/src/main/groovy/org/grails/orm/hibernate/cfg/domainbinding/TableForManyCalculator.java +++ b/grails-data-hibernate7/core/src/main/groovy/org/grails/orm/hibernate/cfg/domainbinding/TableForManyCalculator.java @@ -7,7 +7,6 @@ import org.hibernate.MappingException; import org.grails.datastore.mapping.model.PersistentEntity; import org.grails.datastore.mapping.model.types.Basic; import org.grails.datastore.mapping.model.types.ManyToMany; -import org.grails.orm.hibernate.cfg.GrailsHibernatePersistentProperty; import org.grails.orm.hibernate.cfg.HibernateToManyProperty; import org.grails.orm.hibernate.cfg.JoinTable; import org.grails.orm.hibernate.cfg.PersistentEntityNamingStrategy; @@ -50,7 +49,7 @@ public class TableForManyCalculator { * the relationship has to "own" the relationship so that there is not a situation * where you have two mapping tables for left_right and right_left */ - public String calculateTableForMany(HibernateToManyProperty property, String sessionFactoryBeanName) { + public String calculateTableForMany(HibernateToManyProperty property) { String propertyColumnName = namingStrategy.resolveColumnName(property.getName()); //fix for GRAILS-5895 PropertyConfig config = property.getMappedForm(); 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 b1d2a56f8b..ff18c65c62 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 @@ -1,25 +1,12 @@ package org.grails.orm.hibernate.cfg.domainbinding.collectionType; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.Set; -import java.util.SortedSet; - import org.hibernate.MappingException; -import org.hibernate.boot.spi.InFlightMetadataCollector; import org.hibernate.boot.spi.MetadataBuildingContext; -import org.hibernate.mapping.Bag; import org.hibernate.mapping.Collection; import org.hibernate.mapping.PersistentClass; -import jakarta.annotation.Nonnull; - import org.grails.orm.hibernate.cfg.GrailsDomainBinder; -import org.grails.orm.hibernate.cfg.GrailsHibernatePersistentEntity; -import org.grails.orm.hibernate.cfg.GrailsHibernatePersistentProperty; import org.grails.orm.hibernate.cfg.HibernateToManyProperty; -import org.grails.orm.hibernate.cfg.Mapping; /** * A Collection type, for the moment only Set is supported @@ -36,10 +23,7 @@ public abstract class CollectionType { public Collection create(HibernateToManyProperty property - , PersistentClass owner - , String path - , @Nonnull InFlightMetadataCollector mappings - , String sessionFactoryBeanName) throws MappingException { + , PersistentClass owner) throws MappingException { 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/TableForManyCalculatorSpec.groovy b/grails-data-hibernate7/core/src/test/groovy/org/grails/orm/hibernate/cfg/domainbinding/TableForManyCalculatorSpec.groovy index 9447f332b9..5e136c0215 100644 --- a/grails-data-hibernate7/core/src/test/groovy/org/grails/orm/hibernate/cfg/domainbinding/TableForManyCalculatorSpec.groovy +++ b/grails-data-hibernate7/core/src/test/groovy/org/grails/orm/hibernate/cfg/domainbinding/TableForManyCalculatorSpec.groovy @@ -1,11 +1,10 @@ package org.grails.orm.hibernate.cfg.domainbinding -import org.grails.datastore.mapping.model.PersistentEntity + import org.grails.datastore.mapping.model.types.Basic import org.grails.datastore.mapping.model.types.ManyToMany import org.grails.datastore.mapping.model.types.ToMany import org.grails.orm.hibernate.cfg.GrailsHibernatePersistentEntity -import org.grails.orm.hibernate.cfg.GrailsHibernatePersistentProperty import org.grails.orm.hibernate.cfg.HibernateToManyProperty import org.grails.orm.hibernate.cfg.JoinTable import org.grails.orm.hibernate.cfg.Mapping @@ -57,7 +56,7 @@ class TableForManyCalculatorSpec extends Specification { trimmer.trimBackTigs(_) >> { String s -> s } when: - def result = calculator.calculateTableForMany(property, "default") + def result = calculator.calculateTableForMany(property) then: result == expectedTableName diff --git a/grails-data-hibernate7/core/src/test/groovy/org/grails/orm/hibernate/cfg/domainbinding/collectionType/BagCollectionTypeSpec.groovy b/grails-data-hibernate7/core/src/test/groovy/org/grails/orm/hibernate/cfg/domainbinding/collectionType/BagCollectionTypeSpec.groovy index 70655ce430..327545a5ed 100644 --- a/grails-data-hibernate7/core/src/test/groovy/org/grails/orm/hibernate/cfg/domainbinding/collectionType/BagCollectionTypeSpec.groovy +++ b/grails-data-hibernate7/core/src/test/groovy/org/grails/orm/hibernate/cfg/domainbinding/collectionType/BagCollectionTypeSpec.groovy @@ -35,7 +35,7 @@ class BagCollectionTypeSpec extends HibernateGormDatastoreSpec { def sessionFactoryBeanName = "sessionFactory" when: - def result = collectionType.create(property, owner, path, mappings, sessionFactoryBeanName) + def result = collectionType.create(property, owner) then: result instanceof Bag diff --git a/grails-data-hibernate7/core/src/test/groovy/org/grails/orm/hibernate/cfg/domainbinding/collectionType/ListCollectionTypeSpec.groovy b/grails-data-hibernate7/core/src/test/groovy/org/grails/orm/hibernate/cfg/domainbinding/collectionType/ListCollectionTypeSpec.groovy index dbf24b7313..57b7be05de 100644 --- a/grails-data-hibernate7/core/src/test/groovy/org/grails/orm/hibernate/cfg/domainbinding/collectionType/ListCollectionTypeSpec.groovy +++ b/grails-data-hibernate7/core/src/test/groovy/org/grails/orm/hibernate/cfg/domainbinding/collectionType/ListCollectionTypeSpec.groovy @@ -35,7 +35,7 @@ class ListCollectionTypeSpec extends HibernateGormDatastoreSpec { def sessionFactoryBeanName = "sessionFactory" when: - def result = collectionType.create(property, owner, path, mappings, sessionFactoryBeanName) + def result = collectionType.create(property, owner) then: result instanceof HibernateList diff --git a/grails-data-hibernate7/core/src/test/groovy/org/grails/orm/hibernate/cfg/domainbinding/collectionType/MapCollectionTypeSpec.groovy b/grails-data-hibernate7/core/src/test/groovy/org/grails/orm/hibernate/cfg/domainbinding/collectionType/MapCollectionTypeSpec.groovy index e2c8430300..5977dba092 100644 --- a/grails-data-hibernate7/core/src/test/groovy/org/grails/orm/hibernate/cfg/domainbinding/collectionType/MapCollectionTypeSpec.groovy +++ b/grails-data-hibernate7/core/src/test/groovy/org/grails/orm/hibernate/cfg/domainbinding/collectionType/MapCollectionTypeSpec.groovy @@ -35,7 +35,7 @@ class MapCollectionTypeSpec extends HibernateGormDatastoreSpec { def sessionFactoryBeanName = "sessionFactory" when: - def result = collectionType.create(property, owner, path, mappings, sessionFactoryBeanName) + def result = collectionType.create(property, owner) then: result instanceof HibernateMap diff --git a/grails-data-hibernate7/core/src/test/groovy/org/grails/orm/hibernate/cfg/domainbinding/collectionType/SetCollectionTypeSpec.groovy b/grails-data-hibernate7/core/src/test/groovy/org/grails/orm/hibernate/cfg/domainbinding/collectionType/SetCollectionTypeSpec.groovy index dbfcf3424e..890b6d4ab6 100644 --- a/grails-data-hibernate7/core/src/test/groovy/org/grails/orm/hibernate/cfg/domainbinding/collectionType/SetCollectionTypeSpec.groovy +++ b/grails-data-hibernate7/core/src/test/groovy/org/grails/orm/hibernate/cfg/domainbinding/collectionType/SetCollectionTypeSpec.groovy @@ -35,7 +35,7 @@ class SetCollectionTypeSpec extends HibernateGormDatastoreSpec { def sessionFactoryBeanName = "sessionFactory" when: - def result = collectionType.create(property, owner, path, mappings, sessionFactoryBeanName) + def result = collectionType.create(property, owner) then: result instanceof HibernateSet diff --git a/grails-data-hibernate7/core/src/test/groovy/org/grails/orm/hibernate/cfg/domainbinding/collectionType/SortedSetCollectionTypeSpec.groovy b/grails-data-hibernate7/core/src/test/groovy/org/grails/orm/hibernate/cfg/domainbinding/collectionType/SortedSetCollectionTypeSpec.groovy index 4308e04de2..77a544553c 100644 --- a/grails-data-hibernate7/core/src/test/groovy/org/grails/orm/hibernate/cfg/domainbinding/collectionType/SortedSetCollectionTypeSpec.groovy +++ b/grails-data-hibernate7/core/src/test/groovy/org/grails/orm/hibernate/cfg/domainbinding/collectionType/SortedSetCollectionTypeSpec.groovy @@ -35,7 +35,7 @@ class SortedSetCollectionTypeSpec extends HibernateGormDatastoreSpec { def sessionFactoryBeanName = "sessionFactory" when: - def result = collectionType.create(property, owner, path, mappings, sessionFactoryBeanName) + def result = collectionType.create(property, owner) then: result instanceof HibernateSet
