The GitHub Actions job "Code Analysis" on grails-core.git/8.0.x has succeeded.
Run started by GitHub user borinquenkid (triggered by borinquenkid).

Head commit for run:
057ffcd8129ab7d8852ab662071fe33985cbd551 / Gianluca Sartori 
<[email protected]>
Fix join-table foreign keys to use resolved entity table names (#15736) (#16028)

* PR for: https://github.com/apache/grails-core/issues/15644

* Merge fixes & cleanups

* Fix proposal for https://github.com/apache/grails-core/issues/15736

* Consolidate join-table table-name resolution and fix property-prefix naming

getHibernateAssociatedEntity().getHibernateRootEntity().getTableName(namingStrategy)
was duplicated between resolveJoinTableForeignKeyColumnName() and
joinTableColumName(). Extract it to 
HibernateAssociation#resolveAssociatedEntityTableName
so both to-one and to-many association properties share one implementation.

joinTableColumName() also resolved the collection property-name prefix via
resolveTableName(getName()) even though the result is used as a column, not a
table, on the join table. Under the default snake-case naming strategy this is
indistinguishable from resolveColumnName(), which is why it went unnoticed, but
it produces the wrong prefix under a PhysicalNamingStrategy that treats column
and table naming differently. Switch it to resolveColumnName(getName()).

Co-Authored-By: Claude Sonnet 5 <[email protected]>

* Revert "Merge fixes & cleanups"

This reverts commit d1ca11fc663192167367efae9e14874684d03a70.

* Revert "PR for: https://github.com/apache/grails-core/issues/15644";

This reverts commit bfdbbe88fa63c33b92e3a0ed7e0509ef99b500ac.

* Upgrade guide

* Strip backticks from resolved associated-entity table names

resolveAssociatedEntityTableName's result is only ever used as a
column-identifier fragment (a join-table foreign-key or element
column name) by its callers, never as a literal SQL identifier - so
a backtick-quoted table mapping (e.g. table '`user`') produced a
malformed column like `user`_id via resolveJoinTableForeignKeyColumnName,
generating invalid DDL that fails silently without hbm2ddl.halt_on_error.

Strips backticks once at the source instead of trusting each caller to
do it themselves, since every caller wants the clean form. Adds a
domain-class-only regression test (no mocks) reproducing the bug via a
real unidirectional hasMany join-table binding.

Co-Authored-By: Claude Sonnet 5 <[email protected]>

* Narrow join-table naming fix's scope in code and docs to unidirectional 
hasMany

jdaugherty's review confirmed resolveJoinTableForeignKeyColumnName only runs
for a unidirectional hasMany join table - a bidirectional many-to-many still
derives both columns from class names, unaffected by this change. Documents
that scope explicitly (with a corrected, genuinely-unidirectional example) in
both the upgrade guide and the naming-strategy guide, and cross-references the
two, instead of describing a many-to-many schema change that doesn't happen.

joinTableColumName's isBasic() ternary was dead: both of its callers
(BasicCollectionElementBinder, EnumTypeBinder) always pass a
HibernateBasicProperty, so the association branch never ran and was only
reachable through a mocked naming strategy in the existing test. Dropped the
ternary and replaced that test with one that boots a real PhysicalNamingStrategy
distinguishing column from table naming and asserts the resulting join column,
rather than asserting mock interaction counts on unreachable code.

Renamed the test's Book domain class to HTMPMappedTableBook to match the rest
of the file's HTMP-prefix convention.

Co-Authored-By: Claude Sonnet 5 <[email protected]>

---------

Co-authored-by: Walter Duque de Estrada <[email protected]>
Co-authored-by: Claude Sonnet 5 <[email protected]>
Co-authored-by: James Fredley <[email protected]>

Report URL: https://github.com/apache/grails-core/actions/runs/33138030700

With regards,
GitHub Actions via GitBox

Reply via email to