Reputation: 55
The problem:
In my web application I defined some constraints. That I can save the domain class to "drafts" also when the constraint properties are not matching I set the constraint nullable
to true
. In the following process I can modify the object and after that to finalize the process I want to make a full validation. That means I want to add the nullable:false
property.
Thanks
Upvotes: 2
Views: 703
Reputation: 1266
So example:
def user = new User()
for(constraint in user.constraints) {
constraint.value.setBlank(true)
constraint.value.setNullable(false)
}
For nested fields:
for(constraint in user.someNestedFields.constraints) {
....
}
But i would not recommend to do so. It looks like bad architecture.
To save your domain entity without validation just call save(false)
.
Upvotes: 3