When data integrity validation fails it is reported. In this video, examine how this works and look at strategies for dealing with validation failure management.
- [Instructor] When BIN validation fails,…we want to know about it…so that we can do something to resolve the issue.…If BIN validation happens…as a result of a user entering bad data in a web form,…such as a badly-formatted email address or incorrect date,…we want the user to know about it,…and correct it before submitting the form again.…BIN validation and Java server pages integrate very well,…so when a constrained violation fails,…it is reported and a message is displayed on the web form,…informing the user of the problem.…As I'm using JSF in the presentation day of my application,…I'm going to find it very easy…to show custom error messages on the web form.…
These error messages are configured in three different ways.…Firstly, they can be hard coded…into the constraint annotation logic itself,…as you can see here in the email annotation.…We'll pass through a constraint…via message annotation property, as you can see here.…However, it can also be configured in a resource bundle,…and therefore, they can be internationalized.…
In this course, you can journey through the many constraints that are built into the 2.0 version of the Bean Validation API, as well as the additional constraints provided by the Hibernate Validator 6.0. Learn Bean Validation in a practical way while you build a functioning web application. Instructor Alex Theedom shows how to extend the API with custom constraints and how to internationalize validation failure messages. Plus, learn advanced techniques such as cross-field and cross-parameter validation, and how Bean Validation integrates with other Java EE technologies such as JAX-RS, Java Persistence API (JPA), and JavaServer Faces (JSF). By the end of this course, you will have gained practical experience of using Bean Validation in a real web application and be able to implement what you have learned in your own Java applications.
- What is Bean Validation?
- Applying the built-in constraints
- Applying Hibernate constraints
- Designing custom constraint validators
- Managing and configuring validation failure messages
- Creating custom composite constraints
- Creating custom validation constraints
- Cross-field and cross-parameter validation
- Integration with RESTful web services (JAX-RS)