I am using bean validation with hibernate-validator-4.2.0.Final and JSF 2.1. When i submit the page @NotEmpty, @NotNull
,.. works correct , but my method, annotated with @AssertTrue
is never called.
I changed the access modifier to public, renamed it to getValid, but the method is never called..
@AssertTrue(message = "test")
private Boolean isValid() {
return ....;
}
The problem is that not all fields are validated by JSF, only those that are in my facelet.
If I call
SomeObject so = new SomeObject();
Validator validator = Validation.buildDefaultValidatorFactory().getValidator();
Set<ConstraintViolation<SomeObject>> violations = validator.validate(so);
in a test, the isValid method is triggerd.