I noticed that all built-in constraints have an empty value for the validatedBy
parameter in @Constraint
. i.e. @Constraint(validatedBy = {})
Maybe have a look at this answer:
How to avoid cross dependency between layers because of @Constraint validatedBy?
And those two links:
Adding constraints programmatically: http://docs.jboss.org/hibernate/stable/validator/reference/en-US/html/validator-specifics.html#section-programmatic-api
Adding constraints per xml: http://docs.jboss.org/hibernate/validator/4.1/reference/en-US/html/validator-xmlconfiguration.html