Using a Compare Validator
The Compare validator performs a logical comparison between an entity attribute and another value. You specify the operator and the value to compare. The Compare With list includes:
Depending on your Compare With choice, additional options must be specified, such as the SQL query or the view accessor and attribute. When you define a Compare validator, a <CompareValidationBean> tag is added to the XML file.