The GitHub Actions job "CI" on 
grails-core.git/fix/hibernate7-many-to-many-without-owner-8.0.x has succeeded.
Run started by GitHub user borinquenkid (triggered by testlens-app[bot]).

Head commit for run:
292bc0a327061f7ef36153bc9ad848d00c7211fb / Walter Duque de Estrada 
<[email protected]>
fix: store a many-to-many that has no belongsTo on either side

With neither side declaring belongsTo, both collections of a bidirectional
many-to-many were bound inverse. Hibernate never writes an inverse collection,
so addTo/save through either side persisted nothing: the relationship was lost
silently (and two empty, differently named join tables were created).

Hibernate 5 loses the data the same way (same !isOwningSide() -> setInverse
rule over the shared datastore-core ownership flag; reproduced with the same
spec on grails-data-hibernate5-core), so this is not an H5 behaviour to match.
Failing at startup was tried first and rejected: it breaks 14 existing specs in
this module whose fixtures use that shape, which shows how likely real
applications are to have it too.

HibernateManyToManyProperty.isOwningSide() now picks one owner when neither side
declares belongsTo: the entity whose name sorts first, then the property name.
Both sides apply the same symmetric rule, so exactly one side owns and both
sides resolve the same join table (owner_prop). belongsTo still decides when
present. Cascade defaults are unchanged (save the other entity first, as 
before).

Existing apps with this shape: the schema changes from two unused join tables
to one used table named after the chosen owner. Join-table naming is otherwise
unchanged. TableForManyCalculatorSpec encoded the old degenerate name
(tag_owners) for an owning side without belongsTo and is updated.

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

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

With regards,
GitHub Actions via GitBox

Reply via email to