In this video, learn about all of the ways that constraints can be used. They include on fields, parameters, methods, constructors, List types, Map types, Set types, and Java 8 Optional types. Additionally, learn about the behavior of nested constraints and cascade validation.
- [Narrator] Bean Validation constraints…annotate fields of a class.…And when they do, the value of the field…is accessed directly by the validation engine.…It's important to know that if a field has…the corresponding accessor method,…then this method will not be called…regardless of the accessor modifier of the Bean's fields.…Now, all access modifiers are supported,…except static fields.…Constraints can also annotate methods of Beans,…as long as those methods and your Bean…actually conform to the JavaBean standard.…The accessor method must be annotate,…not the mutator method.…
So, the read-only properties can be accessed.…In the case of property-level constraints,…the Bean Validation engine doesn't…actually cause the accessor method,…and does not access the field directly.…Container elements can also be annotated…with a Bean Validation constraint.…This is done by annotating the parameterized type…argument of the container.…So, it can be used on list types,…and be used on set types.…It can be used on map.…It can be used on Java 8 optional types,…
Author
Released
3/7/2018In 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)
Skill Level Intermediate
Duration
Views
Related Courses
-
WebSocket Programming with Java EE
with Alex Theedom1h 29m Intermediate -
Java Platforms Compared: SE vs EE vs ME
with Peggy Fisher25m 38s Intermediate -
JSON Processing with Java EE
with Alex Theedom1h 4m Intermediate -
Java EE: Design Patterns and Architecture
with Alex Theedom2h 44m Intermediate
-
Introduction
-
Welcome1m 12s
-
What you should know1m 46s
-
-
1. What Is Bean Validation?
-
2. Course Project Introduction
-
Course project walk-through3m 51s
-
How to work with the project3m 45s
-
-
3. Applying Built-In Bean Validation Constraints
-
4. Applying Hibernate Bean Validation Constraints
-
5. Designing Custom Constraint Validators
-
6. Bean Validation Failure Messages
-
Managing validation failures2m 37s
-
✓ Challenge19s
-
✓ Solution52s
-
-
7. Advanced Bean Validation Features
-
Advanced constraint usage1m 52s
-
Conclusion
-
Next steps1m 50s
-
- Mark as unwatched
- Mark all as unwatched
Are you sure you want to mark all the videos in this course as unwatched?
This will not affect your course history, your reports, or your certificates of completion for this course.
CancelTake notes with your new membership!
Type in the entry box, then click Enter to save your note.
1:30Press on any video thumbnail to jump immediately to the timecode shown.
Notes are saved with you account but can also be exported as plain text, MS Word, PDF, Google Doc, or Evernote.
Share this video
Embed this video
Video: Advanced constraint usage