talira

Hibernate Validator

The Bean Validation reference implementation

open sourceApache-2.0free

Hibernate Validator is the reference implementation of the Bean Validation (Jakarta Validation) specification for Java. You express validation rules as annotations on fields, method parameters and return values (@NotNull, @Size, @Min and more, plus its own extra and country-specific constraints), override them in XML if needed, and validate programmatically or automatically through frameworks with built-in support, such as Hibernate ORM, Jakarta Data repositories and Jakarta REST endpoints. Custom constraints are easy to define, and it works on clients as well as servers.

Problems it solves

  • validate Java objects with annotations like @NotNull and @Size instead of hand-written checks
  • reject bad input on a REST endpoint before it reaches my business code in Java
  • define a custom validation rule once and reuse it across entities
  • check method parameters and return values automatically in a Java service

Features

  • annotation-based constraints
  • constraints overridable in XML
  • extra and country-specific constraint types
  • custom constraints
  • metadata API
  • automatic validation through Hibernate ORM, Jakarta Data and Jakarta REST
  • works client-side as well as on servers