5

I would like to know instead of the Hibernate validator @Min which is inclusive (equal or greater than) is there a way to express "strictly greater than" a number?

Thanks very much :)

2 Answers 2

10

If you work with Bean Validation 1.1 (part of Java EE 7) you may use @DecimalMin instead which has an additional attribute, inclusive, which controls whether "strictly greater than" or "greater than or equals to" semantics are used.

1
  • 1
    e.g. @DecimalMin(value = "0.0", inclusive = false) Apr 15, 2019 at 13:35
4

Not with the built-in constraints. You would need a custom constraints. But if you are dealing with integers you can always use @Min with your limit + 1.

1
  • Agree, this is the only way :)
    – wceo
    Oct 4, 2013 at 11:55

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.