0

I have a question about hibernate validator:

class A
{
  private String a;
  private String b;
}

String a and b can either be null but can't both be null. How can I use Hibernate Validator to validate this case?

Thanks,

Sean Patrick Floyd
  • 284,665
  • 62
  • 456
  • 576
Sean Nguyen
  • 11,700
  • 20
  • 69
  • 109
  • Pretty sure this is a dupe of http://stackoverflow.com/questions/1972933/cross-field-validation-with-hibernate-validator-jsr-303 – Patrick Jan 02 '13 at 23:35

1 Answers1

2

Use a custom class level validator to do this.

From the Hibernate Validator Reference:

Samuel Parsonage
  • 2,957
  • 1
  • 16
  • 20
lweller
  • 10,753
  • 3
  • 32
  • 37