I have written a custom validator that is scoped to the whole class so that I can access multiple properties and do the validation. I had implemented this based on the following article
http://www.jroller.com/page/jgilbert01?entry=extending_the_hibernate_validation_framework
As you see below the IdTypeValidator is my custom validator and I am passing in the Product object as value.
@Entity
@Table(name = "PRODUCTS")
@IdTypeValidator(value=Product.class)
public class Product{
...
}
The validator does get invoked and when the validation fails how to display this error message. As this validator is annotated to the whole class I cannot tie it to any particular field on the JSF page.