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

   Resolves #16774.
   
   ### Summary
   When multiple unidirectional associations share a join table, Hibernate 
binds them using a single table. Previously, 
`SharedJoinTableUniqueKeyBinder.hasColumnsOfOthers` detected any unowned column 
on the shared join table and applied `<element> is not null` `where` 
restrictions to all collections on that table.
   
   However, in the standard shared join table shape (`hasMany = [roles: Role, 
denyRoles: Role]`), each collection has its own separate foreign key column 
(`roles_id`, `deny_roles_id`). Such collections are already isolated by foreign 
key, so deleting or loading by key only affects their own rows. Applying 
`where` restrictions to them caused `RestrictedCollectionSqmTranslatorFactory` 
(from #16748) to translate `is empty` into a count query rather than the 
standard SQM `not exists` query.
   
   ### Changes
   - In `SharedJoinTableUniqueKeyBinder`, check 
`sharesKeyColumnWithOther(member, sharing)` before applying `where` 
restrictions so that only collections sharing an actual key column receive them.
   - Updated `SharedJoinTableUniqueKeyBinderSpec` to verify that standard 
associations on shared join tables with separate keys have `where == null`, 
while collections sharing a foreign key column keep `where == '<element> is not 
null'`.
   - Clarified `upgrading80x.adoc` documentation regarding list/map/bag keys 
and default configuration of `hibernate.query.sqm.translator`.


-- 
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