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

   **Summary**
   
   Restore Grails 7’s Hibernate validation error-reset behavior in both the 
Hibernate 5 and Hibernate 7 integrations.
   
   At the start of validation:
   - Preserve existing field errors marked as binding failures.
   - Clear previously added global errors and non-binding field errors.
   - Continue honoring errors raised during the current validation by 
constraints and beforeValidate callbacks.
   
   **Background**
   
   Commit e53dfd9ba532895a70d6c9912a66338336e9425d 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**
   - Restore binding-failure-only copying in both Hibernate implementations.
   - Update the shared TCK to explicitly test the datastore-specific behavior.
   - Add matching Hibernate 5 and Hibernate 7 regression coverage for:
   - validate(), map arguments, and field-list arguments.
   - Explicit saves and dirty-entity flushes.
   - Existing global and non-binding field errors.
   - Preservation of binding-error details.
   - Constraint failures and newly raised beforeValidate errors.
   - Document the Hibernate error-reset lifecycle in the validate() reference.
   Verification
   - Reproduced the behavior difference using identical real Hibernate/H2 tests 
against Grails 7.2.4 and the unpatched Grails 8 snapshot.


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