Your First Cup: An Introduction to the Java EE Platform

ProcedureAdd Properties to the FirstcupUser Entity

Create the FirstcupUser entity's two properties: birthday, of type java.util.Calendar; and ageDifference, of type int.

The birthday property must be annotated with the javax.persistence.Temporal annotation to mark the property as date field in the underlying database table. All persistent fields or properties of type java.util.Calendar or java.util.Date must be annotated with @Temporal.

  1. Right-click the editor window, select Insert Code, then Add Property.

  2. In the Add Property dialog, enter birthday under Name, java.util.Calendar under Type, and click OK.

  3. Click the error glyph next to the new birthday field and select Add @Temporal Annotation.

  4. Right-click the editor window, select Insert Code, then Add Property.

  5. In the Add Property dialog, enter ageDifference under Name, int under Type, and click OK.