Sean Nguyen
Sean Nguyen

Reputation: 13118

hibernate validator for cross field validation

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,

Upvotes: 0

Views: 1603

Answers (1)

lweller
lweller

Reputation: 11317

Use a custom class level validator to do this.

From the Hibernate Validator Reference:

Upvotes: 2

Related Questions