borinquenkid opened a new pull request, #16531:
URL: https://github.com/apache/grails-core/pull/16531

   ## Problem
   In a bidirectional many-to-many where only the **owning** side configures 
`joinTable: [name:, key:, column:]`, the inverse side names its join table from 
its own (default) mapping, so it reads a table nobody writes: 
`Inverse.get(id).owners` is empty although the owner saved the relationship.
   
   ## Fix
   `CollectionBinder.inheritOwningJoinTable`: a non-owning many-to-many without 
its own join table name adopts the owner's name, schema and catalog; its key is 
the owner's `column` and its column is the owner's `key`. An inverse side that 
names its own table is untouched.
   
   ## Notes
   Hibernate 5 does the same lookup from the inverse side's own mapping, so it 
also needs `joinTable` on both sides (the documented example does); this is not 
an H7 regression but a gap that H7 can close. Low risk: only affects inverse 
sides that had no join table name of their own, which previously pointed at an 
unused table. Short note added to `joinTable.adoc`.
   
   ## Tests
   New `ManyToManyInverseJoinTableSpec` (persist through the owner, read 
through the inverse; failed before) and three `CollectionBinderSpec` rows. 
`cfg.domainbinding*` and `grails.gorm.tests.*`: 1548 tests, 0 failures.
   
   🤖 Generated with [Claude Code](https://claude.com/claude-code)
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to