borinquenkid commented on issue #14545: URL: https://github.com/apache/grails-core/issues/14545#issuecomment-6183474791
Root cause: `validate()` sets the session to `FlushMode.MANUAL` while it runs, and the `finally` block restored the previous mode only when validation succeeded. After a failed `validate()` the session stayed in MANUAL, so the surrounding transaction never flushed on commit. Fixed by restoring the flush mode unconditionally, in both the Hibernate 7 and Hibernate 5 modules: - 8.0.x: #16651 - 9.0.x: #16652 (forward port) 7.0.x is also affected (the Hibernate 5 module has the same code) and has not been patched. The Hibernate 5 hunk and `ValidateRestoresFlushModeSpec` from #16651 apply to it, so anyone who needs the fix there can cherry-pick that commit. 🤖 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]
