In fact, the validation system requires several things.
You need a validation API. It seems like yours, but you must remember that GWT needs a source of included files.
To make this work, you need to enable both the API and the sources of the API.
<dependency> <groupId>javax.validation</groupId> <artifactId>validation-api</artifactId> <version>1.0.0.GA</version> <type>jar</type> <classifier>sources</classifier> </dependency> <dependency> <groupId>javax.validation</groupId> <artifactId>validation-api</artifactId> <version>1.0.0.GA</version> <type>jar</type> </dependency>
Without this, you will get a class of not found exceptions for the validation API.
You also need to make sure that you have added the inclusion of validation in your GWT XML module.
<inherits name="org.hibernate.validator.HibernateValidator" /> <replace-with class="com.google.gwt.sample.validation.client.SampleValidatorFactory"> <when-type-is class="javax.validation.ValidatorFactory" /> </replace-with>
In addition, you also need to enable some kind of verification mechanism. You probably need a hibernate check if you follow the GWT bean validation guide.
To test an annotated object, you must use the provided API.
import javax.validation.Validation; import javax.validation.Validator; import javax.validation.ValidatorFactory; import javax.validation.ConstraintViolation;
Good luck.
source share