0

Is there a way to achieve depends on behavior with hibernate validation. For instance if i have two custom validations

@InvalidAmount // Validates the amount is invalid with some custom logic
@AmountNotAccepted // Validates the currency is not accepted along with some custom logic

The idea is not to merge both of them together and throw second error only if the first one succeeds. Is there a way to do it? Something like run the second validate only first first is not an error.

For example:

@AmountNotAccepted(dependsOn = {InvalidAmount})
Adiant
  • 859
  • 4
  • 16
  • 34

1 Answers1

0

You may be after group sequences?

yrodiere
  • 9,280
  • 1
  • 13
  • 35
  • I am afraid that group sequence would not work. All the annotations belong to the default group by default – Adiant Jul 17 '20 at 10:19