Validating your application's data is a required step before any of your business operations. Jakarta EE provides the Java Validation API, which integrates well with other APIs, like JPA and JAX-RS. With this API, you can declare all your validation rules to be processed automatically for you, whenever you receive new data from the user. It's as easy as annotating your domain objects with the appropriate annotation.
In Chapter 4, Validating Data with Bean Validation 2.0, we'll learn how to use the Java Validation API to perform programmatic and automatic bean validation, how to validate graphs of objects in a bean, and the different validation constraints available. Moreover, we'll learn how to validate bean method parameters and return values, and how to define custom validation constraints to handle more complex and recurrent validation scenarios.