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
  • 292,901
  • 67
  • 465
  • 588
Sean Nguyen
  • 12,528
  • 22
  • 74
  • 113
  • 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
  • 3,077
  • 1
  • 18
  • 21
lweller
  • 11,077
  • 3
  • 34
  • 38