Validating temporal fields
java.util.Calendar classes can be used to represent time in Java. If these classes are used for fields of an entity, the @Temporal annotation needs to be used. In addition, the @Future or @Past annotations are used to specify constraints on the relationship of the assigned date to the current time.
We will use the
LicenseBeanFacade classes from the
ValidationApplication as discussed in the Validating persistent fields and properties recipe.
The @Temporal annotation designates a field as a time unit. JPA permits three basic mappings:
How to do it...
This annotation is used to annotate a
Calendar field as ...