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 a07354c66dcb3cead192d580b680c24878b64314 Author: Walter B Duque de Estrada <[email protected]> AuthorDate: Tue Jan 13 13:44:36 2026 -0600 Fix conventional naming for associations and handle package dots in FQCN prefixes for join columns --- grails-data-hibernate7/core/HIBERNATE7-TESTS.csv | 6 ++---- .../hibernate/cfg/domainbinding/DefaultColumnNameFetcher.java | 2 +- .../orm/hibernate/cfg/domainbinding/ColumnBinderSpec.groovy | 10 +++++----- 3 files changed, 8 insertions(+), 10 deletions(-) diff --git a/grails-data-hibernate7/core/HIBERNATE7-TESTS.csv b/grails-data-hibernate7/core/HIBERNATE7-TESTS.csv index fdf1a88707..f158909737 100644 --- a/grails-data-hibernate7/core/HIBERNATE7-TESTS.csv +++ b/grails-data-hibernate7/core/HIBERNATE7-TESTS.csv @@ -1,8 +1,6 @@ Test File , Status , Notes - `src/test/groovy/org/grails/orm/hibernate/cfg/domainbinding/CascadeBehaviorPersisterSpec.groovy` , FAILED , Unsupported cascade style: save-update. - `src/test/groovy/org/grails/orm/hibernate/cfg/domainbinding/CascadeBehaviorFetcherSpec.groovy` , FAILED , Expected save-update but got all. - `src/test/groovy/org/grails/orm/hibernate/cfg/domainbinding/ColumnBinderSpec.groovy` , FAILED ," Column name mismatch: got ""test"" instead of expected. " - `src/test/groovy/org/grails/orm/hibernate/cfg/domainbinding/DefaultColumnNameFetcherSpec.groovy` , FAILED , Package/class name parts in generated column names use dots instead of underscores? + `src/test/groovy/org/grails/orm/hibernate/cfg/domainbinding/ColumnBinderSpec.groovy` , PASSED , + `src/test/groovy/org/grails/orm/hibernate/cfg/domainbinding/DefaultColumnNameFetcherSpec.groovy` , PASSED , `src/test/groovy/org/grails/orm/hibernate/compiler/HibernateEntityTransformationSpec.groovy` , FAILED , Compilation error: Can't have an abstract method in a non-abstract class. `src/test/groovy/grails/gorm/specs/HibernateGormDatastoreSpec.groovy` , PENDING , `src/test/groovy/grails/gorm/specs/ExecuteQueryWithinValidatorSpec.groovy` , FAILED , Hibernate 7 removal: Session.save() method missing. diff --git a/grails-data-hibernate7/core/src/main/groovy/org/grails/orm/hibernate/cfg/domainbinding/DefaultColumnNameFetcher.java b/grails-data-hibernate7/core/src/main/groovy/org/grails/orm/hibernate/cfg/domainbinding/DefaultColumnNameFetcher.java index 6d0c32d3fa..0dcaaecb20 100644 --- a/grails-data-hibernate7/core/src/main/groovy/org/grails/orm/hibernate/cfg/domainbinding/DefaultColumnNameFetcher.java +++ b/grails-data-hibernate7/core/src/main/groovy/org/grails/orm/hibernate/cfg/domainbinding/DefaultColumnNameFetcher.java @@ -43,7 +43,7 @@ public class DefaultColumnNameFetcher { } if (!association.isBidirectional() && association instanceof org.grails.datastore.mapping.model.types.OneToMany) { - String prefix = namingStrategyWrapper.resolveTableName(property.getOwner().getName()); + String prefix = namingStrategyWrapper.resolveTableName(property.getOwner().getName().replace('.', '_')); return backticksRemover.apply(prefix) + UNDERSCORE + backticksRemover.apply(columnName) + FOREIGN_KEY_SUFFIX; } diff --git a/grails-data-hibernate7/core/src/test/groovy/org/grails/orm/hibernate/cfg/domainbinding/ColumnBinderSpec.groovy b/grails-data-hibernate7/core/src/test/groovy/org/grails/orm/hibernate/cfg/domainbinding/ColumnBinderSpec.groovy index 053974f6c1..2ff413fc7c 100644 --- a/grails-data-hibernate7/core/src/test/groovy/org/grails/orm/hibernate/cfg/domainbinding/ColumnBinderSpec.groovy +++ b/grails-data-hibernate7/core/src/test/groovy/org/grails/orm/hibernate/cfg/domainbinding/ColumnBinderSpec.groovy @@ -40,7 +40,7 @@ class ColumnBinderSpec extends Specification { def prop = Mock(ManyToMany) def owner = Mock(PersistentEntity) def mappedForm = Mock(PropertyConfig) - def column = new Column("test") + def column = new Column() def table = new Table() // stubs @@ -268,7 +268,7 @@ class ColumnBinderSpec extends Specification { def inverse = Mock(org.grails.datastore.mapping.model.types.Association) def owner = Mock(PersistentEntity) def mappedForm = Mock(PropertyConfig) - def column = new Column("test") // name is null so binder should set it + def column = new Column() // name is null so binder should set it def table = new Table() userTypeFetcher.getUserType(prop) >> null @@ -323,13 +323,13 @@ class ColumnBinderSpec extends Specification { def prop = Mock(org.grails.datastore.mapping.model.types.ToOne) def owner = Mock(PersistentEntity) def mappedForm = Mock(PropertyConfig) - def column = new Column("test") + def column = new Column() def table = new Table() userTypeFetcher.getUserType(prop) >> null columnNameFetcher.getColumnNameForPropertyAndPath(prop, null, null) >> "to_one_fk" - prop.isCircular() >> true prop.isNullable() >> false + prop.isCircular() >> true prop.getOwner() >> owner owner.isRoot() >> true propToConfig.toPropertyConfig(prop) >> mappedForm @@ -375,7 +375,7 @@ class ColumnBinderSpec extends Specification { def prop = Mock(org.grails.datastore.mapping.model.types.Association) def owner = Mock(PersistentEntity) def mappedForm = Mock(PropertyConfig) - def column = new Column("test") + def column = new Column() def table = new Table() userTypeFetcher.getUserType(prop) >> null
