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

   Follow-up to #16542, found while reviewing #16532 (the Hibernate 7 
counterpart).
   
   ## What
   
   The "neither side declares belongsTo" startup warning from #16542 had two 
gaps:
   
   * **False warning for a Map-valued many-to-many.** The warning runs while 
the collection is still inverse. `bindMapSecondPass` then sets `inverse=false`, 
so the Map side writes the join table and the relationship *is* stored, yet the 
log said it was not. A relationship with a `Map` on either side now logs 
nothing.
   * **Silent data loss for a circular many-to-many.** The shape was excluded, 
so `following`/`followers` on one class (with `mappedBy` pointing at each other 
and no `belongsTo`) created two join tables and stored nothing, with no 
warning. It now warns. Both sides tie on the owner name, so the property names 
decide which side logs, keeping it once per relationship. The existing text 
applies unchanged: `static belongsTo = User` makes the relationship stored, 
from both sides.
   
   This matches what #16532 does for Hibernate 7 on `8.0.x`.
   
   ## Tests
   
   `ManyToManyWithoutOwnerWarningSpec` gains Map/Set and Map/Map pairs (no 
warning), a write through the Map side (stored), a circular mapping without 
`belongsTo` (one warning naming both properties and the remedy) and with 
`belongsTo` (no warning, stored from both sides), and the unidirectional 
self-reference. `grails-data-hibernate5-core`: 652 tests, 0 failures (28 
skipped); `codeStyle` passes.
   
   ## Docs
   
   The H5 Many-to-Many guide covers the self-referencing shape and notes that a 
Map side needs no `belongsTo`.
   
   🤖 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