Repository navigation
Restore Hibernate validation error-reset semantics - #16489
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## 8.0.x #16489 +/- ##
==================================================
+ Coverage 59.2827% 59.3681% +0.0855%
- Complexity 24770 24829 +59
==================================================
Files 2170 2171 +1
Lines 108121 108186 +65
Branches 19709 19729 +20
==================================================
+ Hits 64097 64228 +131
+ Misses 35147 35031 -116
- Partials 8877 8927 +50
🚀 New features to boost your workflow:
|
This comment has been minimized.
This comment has been minimized.
jamesfredley
left a comment
There was a problem hiding this comment.
Approved.
Hibernate 5 and Hibernate 7 again copy only binding-failure field errors at the start of validation. Previous global errors and ordinary field errors are cleared. Errors raised during the current validation, including beforeValidate, still fail the save. The shared GORM validation API is unchanged, and the TCK still requires other datastores to retain global errors.
CI on 185ab62 passed the new regression cases on both Hibernate 5 and Hibernate 7, plus the modified TCK assertions.
Add a Hibernate 5 spec that calls setupErrorsProperty directly, and extend the Hibernate 7 spec, covering global errors, mixed error types, binding failure details, and non-GormValidateable targets. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
borinquenkid
left a comment
There was a problem hiding this comment.
Approving. I pushed one commit (5288a8d) that only expands test coverage: a Hibernate 5 spec that calls setupErrorsProperty directly, and two extra cases in the Hibernate 7 HibernateRuntimeUtilsSpec (global errors not copied, a mix of error types). There are no production changes and I found no bugs. The full Hibernate 5 and 7 core suites pass.
Summary
Restore Grails 7’s Hibernate validation error-reset behavior in both the Hibernate 5 and Hibernate 7 integrations.
At the start of validation:
Background
Commit e53dfd9 changed Hibernate’s error initialization to copy existing global errors into the new errors object.
Previously, Hibernate validation discarded those global errors. Consequently, existing application code that adds a global error with errors.reject(...) can behave differently after upgrading: subsequent validation, saves, or dirty-entity flushes retain that error and fail, even when the entity satisfies its constraints.
This PR restores the previous Hibernate behavior. Other GORM datastores retain their existing semantics.
Changes
Verification