davebrown1975 opened a new issue, #14365:
URL: https://github.com/apache/grails-core/issues/14365

   ### Task List
   
   - [x] Steps to reproduce provided
   - [x] Stacktrace (if present) provided (Not required)
   - [x] Example that reproduces the problem uploaded to Github
   - [x] Full description of the issue provided (see below)
   
   ### Steps to Reproduce
   
   1. Run CustomerSpec.groovy
   2. Note the Customer domain class includes a Long firmId field with a 
non-nullable constraint.
   3. Note the Customer domain class implements MuiltiTenant and a mapping for 
the tenantId to the firmId field.
   
   ### Expected Behaviour
   
   Running the test will attempt to save an instance of the Customer class 
without setting the mandatory firmId field.  This should throw a validation 
exception.
   
   ### Actual Behaviour
   
   A ValidationException is not thrown.  On inspection via a debugger, we can 
see in the Gorm DefaultConstraintEvaluator, the firmId field is considered a 
'derived' property and as a result is removed from the list of properties to be 
constrained.  Therefore validation never takes place. 
   
   ### Environment Information
   
   - **Operating System**: Windows
   - **GORM Version:** 7.2.1
   - **Grails Version (if using Grails):** 5.1.7
   - **JDK Version:** 8
   
   ### Example Application
   
   - https://github.com/davebrown1975/grails_multitenant_validation
   
   


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