From the course: Learning Java Enterprise Edition

Unlock the full course today

Join today to access over 22,600 courses taught by industry experts or purchase this course individually.

Bean Validation introduction

Bean Validation introduction - Java EE Tutorial

From the course: Learning Java Enterprise Edition

Start my 1-month free trial

Bean Validation introduction

- [Instructor] In this video we'll look at the cross cutting use of the bean validation API, how to state the constraint that our field must adhere to in order to pass validation, and how the API can be expanded with custom bean validators. Okay, so let's get started. So as mentioned before, bean validation cuts across applications layers and touches any aspect of an application where data integrity needs to be maintained. Even though it is a relatively small API, it is very effective at cutting down the kind of repetitive code that you have to write to do the job of maintaining data integrity. Validation occurs on the bean's fields, method parameter or return value, and it's about asserting that a certain restriction is adhered to. Validation is triggered by the internal mechanism of the provider relevant for the API that you're using, and this happens transparently. So for JPA entities, it's the JPA provider that triggers the bean validation and likewise for properties bound to JSF…

Contents