Re-using GORM Validations
Last updated
Was this helpful?
Last updated
Was this helpful?
Example code is available on .
When we define validation rules, constraints, in domain class we probably do not want to repeat that validation rules in Vaadin code. We would rather re-use it in Vaadin code for validation of input fields.
We can get constraints from a domain class and use it. Because Vaadin provides many validator, we can use them and fill it with what we have defined in constraints
for a domain class.
Assume we have a product, domain class, that has a name. The product name needs to fulfil certiain validation rules. The name cannot be blank, it has too be more than 2 characters long and maximum lenght is 255.
Then we can get the constraints in Vaadin code and use it as parameters for validation.