You can use BeanValidationBInder to add JSR 303 validation https://vaadin.com/docs/-/part/framework/datamodel/datamodel-forms.html
In the documentation it’s written:
Bean level validation can only be performed once the bean has been updated.
This means that this functionality can only be used together with setBean.
You need to trigger validation manually if using readBean and writeBean.
But it does work in buffered and unbuffered mode.
It does not automatically add a JSR-303 bean-level validator.(for the 2 modes but I don’t know how it can work before writeBean for buffered mode ) https://github.com/vaadin/framework/issues/8498
It seems to me that someone in vaadin does not like notes. For what was simple now seems complex and difficult to implement. This has a very large impact on the conversion of our systems.
Does anyone here leave the validations in proprietary classes? And the interoperability between several platforms, since hibernate annotations can be used by many tools.
If I’m talking nonsense I’m sorry, but the feeling I have in these last months is to stay at 7 and leave the 8 and wait for a 9.
To use JSR-303 validation you need to have an implementation of JSR-303 validation (like hibernate-validator). It’s quite easy to use.
1/ Add a jar or a dependency in your pom.
2/ Change your code
Before
Binder binder = new Binder<>(Person.class);
After
Binder binder = new BeanValidationBinder<>(Person.class);