Reputation: 67802
Is there a way to set a constraint for all properties of a grails domain object?
I want to set nullable: true
for a class, essentially.
Upvotes: 2
Views: 406
Reputation: 120286
I don't think you can. From what I can find, your only options are:
static constraints
closure on the domain classI dug around through DefaultConstraintEvaluator.groovy to see if there was some undocumented way to maybe use a class or property name in the grails.gorm.default.constraints
configuration, but didn't find any.
Perhaps you could submit a JIRA feature request to allow configuring default constraints per-class (by adding to the existing default constraints DSL).
Upvotes: 2