posted 8 years ago
I am looking for javax or Hibernate Validation for the following scenario
We have 2 fields
1. Primary Phone Number
2. Secondary Phone Number
Secondary phone number is optional .
We want to secondary phone number to be either null OR if it is not null then a Custom validation "ValidPhoneNumber" is applied to it.
So the problem is quite general : Apply some validation when it is not null OR Null. (For optional Fields) . I wonder if there is some elegant way in Hibernate Validation Framework to do it.
Cheers!!!