3. Make a JPA Entity Class Model

Using the information design model shown in Figure 6.1 above as the starting point, we make a JavaBean data model with getters/setters and corresponding Java datatypes.

Figure 6.2. Deriving a JavaBean data model from an information design model

Deriving a JavaBean data model from an information design model
Deriving a JavaBean data model from an information design model
Deriving a JavaBean data model from an information design model

The data model defines the following constraints:

  1. The isbn attribute is declared to be a standard identifier, implying that it is mandatory and unique.

  2. The isbn attribute has a pattern constraint requiring its values to match the ISBN-10 format that admits only 10-digit strings or 9-digit strings followed by "X".

  3. The title attribute is mandatory.

  4. The year attribute is mandatory and has an interval constraint, however, of a special form since the maximum is not fixed, but provided by the calendaric function nextYear().