- 

Available since OmniFaces 1.7

By default, Faces validators run on every request, regardless of whether the submitted value has changed or not. In case of validation against the DB on complex objects which are already stored in the model in a broader scope, such as the view scope, this may result in unnecessarily expensive service/DAO calls. In such case, you'd like to perform the expensive service/DAO call only when the submitted value is really changed as compared to the model value.

This validator offers you a template to do it transparently. To use it, just change your validators from:

public class YourValidator implements Validator<YourEntity> {

    public void validate(FacesContext context, UIComponent component, YourEntity submittedValue) {
        // ...
    }

}

to

public class YourValidator extends ValueChangeValidator<YourEntity> {

    public void validateChangedObject(FacesContext context, UIComponent component, YourEntity submittedValue) {
        // ...
    }

}
So, essentially, just replace implements Validator by extends ValueChangeValidator and rename the method from validate to validateChangedObject.