borinquenkid commented on issue #16665: URL: https://github.com/apache/grails-core/issues/16665#issuecomment-6282941816
Root cause and fix are in #16686 (targets 8.0.x, so 8.0.1). `CollectionKeyColumnUpdater` set the key of every entity collection to non-updatable when the owner had two or more unidirectional to-many properties. That is the workaround for #10811, where two `hasMany` to the same class share one join table. Hibernate writes no join table rows for a collection whose key is not updatable, so the `addTo*` of a collection with a join table of its own was dropped on flush, as reported here. The key is now non-updatable only when another unidirectional to-many property of the owner uses the same collection table. The class is identical on 8.1.x, 9.0.x, 9.1.x and 10.0.x, so it should merge forward through them. The Groovy conversion of the Hibernate 7 modules (#16572) carries a hand-ported version of the same change. One point from this thread is not changed by #16686: when two properties do share a join table, the key stays non-updatable, so an element added to one of those is still not written. Whether that case should fail at startup instead is a separate decision. -- 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]
