I am trying to use Java EE 6 Validation as specified here
http://docs.oracle.com/javaee/6/tutorial/doc/gircz.html
I have annotated a simple field
@Max(11)
@Min(3)
private int numAllowed;
The docs says "For a built-in constraint, a default implementation is available" but how do I specify this. My constraints checks are not kicking in. I would expect it to work on calling of the setter method for the field. The only import in my class is
import javax.validation.constraints.Max;
import javax.validation.constraints.Min;
How/where do I specify the implementation? I am putting the constraint on a filed in a simple POJO not an @Entity class, is this ok?
See Question&Answers more detail:os