rafajaw opened a new issue, #14615: URL: https://github.com/apache/grails-core/issues/14615
### Task List - [X] Steps to reproduce provided - [X] Stacktrace (if present) provided - [X] Example that reproduces the problem uploaded to Github - [X] Full description of the issue provided (see below) ### Steps to Reproduce 1 - Create a Domain class called Parent with a property Child. 2 - Create a Domain class called Child with dummy string as property and a back-reference as static belongsTo = [ parent : Parent ]; 3 - Set a constraint on Child to parent( nullable: false ). 4 - Use databinding on parent to populated the child's dummy string. 5 - Call validate() method on parent - it will return TRUE on grails 3.1.12 and FALSE on 3.2.9. ### Expected Behaviour The call to validate() method on parent should always return TRUE for backwards compatibility and not breaking existing code. ### Actual Behaviour The call to validate() method on parent returns different values depending on the Grails version running. ### Environment Information - **Operating System**: Windows 10 64 bits - **Grails Version:** 3.1.12 and 3.2.9 confirmed for inconsistency. - **JDK Version:** jdk1.8.0_121 - **Container Version (If Applicable):** Tomcat8 ### Example Application Example running with Grails 3.1.12 https://github.com/rafajaw/grails-validate-issue-a Example running with Grails 3.2.9 https://github.com/rafajaw/grails-validate-issue-b ### Additional notes In further investigation we can see that validate() method fails in Grails 3.2.9 because the constraint "parent( nullable: false )" wasn't met in the child object. However, if we call parent.save() then the back-reference from child to parent gets populated properly and the validate() method begins to return TRUE even for Grails 3.2.9. Which is not always the use-case, in some use-cases we want to explicitly call validate on the object without saving it. -- 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]
