In this video, implement some of the most useful constraints provided by the Hibernate Validator Bean Validation implementation.
- Okay, so lets add the credit card constraint…to the credit card field in the client bean.…So, I'm just going to navigate to the client bean,…which, you'll remember, is in the model package,…and let's just scroll down to where the credit card is.…This is quite a simple constraint, and has only one flag,…the Ignore Non-Digit Characters flag,…that when set to true, will ignore dashes, spaces,…slashes in the credit card number entered.…Okay, so let's enter than right now.…@CreditCard, okay.…
And then, we're going to pass into it the flag,…and set the flag.…In this case, I want the flag to be true,…because I want to be able to enter slashes and spaces…in my credit card number.…Okay, so let's go to the test class.…So, as you can see, I have four empty tests.…The first test tests whether the number is invalid,…the next one tests if the number is valid,…then the third test tests to make sure…that dashes are acceptable,…and then the final one tests to make sure that…if it's null, it's not acceptable, either.…
Okay, so let's get started with the first test.…
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: Hibernate constraints implementation