Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tenant Id field skips validation when the domain implements MultiTenant #1659

Open
4 tasks done
davebrown1975 opened this issue Jun 12, 2022 · 0 comments
Open
4 tasks done

Comments

@davebrown1975
Copy link

davebrown1975 commented Jun 12, 2022

Task List

  • Steps to reproduce provided
  • Stacktrace (if present) provided (Not required)
  • Example that reproduces the problem uploaded to Github
  • 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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant