From the course: Java EE: Bean Validation
Unlock the full course today
Join today to access over 22,600 courses taught by industry experts or purchase this course individually.
Cross-field validation implementation
From the course: Java EE: Bean Validation
Cross-field validation implementation
- [Instructor] Cross-field validation is about validating multiple fields together. There are a number of typical scenarios where you might want to do this. For example, on a sign-up form where you are asked to enter your email address or password twice, the two fields should be validated together to ensure that they are equal; to check the dates on the form are in chronological order; to verify the different check boxes ticked, that the information required has been entered; and to perform calculations on the fly to ensure that limits are not exceeded. And there are many more examples besides ... just these. Let's implement the last scenario on the list to the transaction BIN. So I want to implement BIN validation logic that limits the maximum transaction value for a purchase or a sale. This means that the quantity of stock multiplied by the price must not exceed to specified amount. Let's jump into the code and get stuck in. What I need to do is create a custom constraint and make…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.