Search code examples
jakarta-eebean-validationhibernate-validator

What is the closest equivalent in JSR 303 for @ScriptAssert?


There is an excellent @ScriptAssert in Hibernate validator which makes cross field validation very easy.

In Java EE, JSR-303 borrowed almost everything from Hibernate validator, but it does not seem to have borrowed @ScriptAssert (yet).

What is the closest equivalent in JSR 303 for @ScriptAssert?


Solution

  • There is no equivalent constraint defined by the Bean Validation specification itself. If you don't want to depend on @ScriptAssert for portability reasons, your best choice would be create your own custom script-based constraint.