Part II. Integrity Constraints

For catching various cases of flawed data, we need to define suitable integrity constraints that can be used by the application's data validation mechanisms. Integrity constraints may take many different forms. The most important type of integrity constraints are property constraints, which define conditions on the admissible property values of an object of a certain type.

Table of Contents

5. Integrity Constraints and Data Validation
1. Introduction
2. Integrity Constraints
2.1. String Length Constraints
2.2. Mandatory Value Constraints
2.3. Range Constraints
2.4. Interval Constraints
2.5. Pattern Constraints
2.6. Cardinality Constraints
2.7. Uniqueness Constraints
2.8. Standard Identifiers (Primary Keys)
2.9. Referential Integrity Constraints
2.10. Frozen Value Constraints
2.11. Beyond property constraints
3. Responsive Validation
4. Constraint Validation in MVC Applications
5. Criteria for Evaluating the Validation Support of Frameworks
6. Quiz Questions
6.1. Question 1: Where to Check Constraints
6.2. Question 2: Where to Define Constraints
6.3. Question 3: Counting Constraints
6.4. Question 4: Constraint Names
6.5. Question 5: Compliant Objects
6. Implementing Constraint Validation in a Java Web App
1. Java Annotations for Persistent Data Management and Constraint Validation
1.1. JPA database constraint annotations
1.2. Bean validation annotations
2. New Issues
3. Make a JPA Entity Class Model
4. Style the User Interface with CSS
5. Write the Model Code
5.1. Type mapping
5.2. Encode the constraints as annotations
5.3. Checking uniqueness constraints
5.4. Dealing with model related exceptions
5.5. Requiring non-empty strings
6. Validation in the View Layer
6.1. Form validation for the Create Object use case
6.2. Form validation for the Update Object use case
7. Defining a Custom Validation Annotation
8. Run the App and Get the Code
9. Possible Variations and Extensions
9.1. Object-level constraint validation
9.2. Alternative class level custom constraint validation
7. Practice Projects
1. Project 1 - Develop a Java Back-End App with Constraint Validation