Your First Cup: An Introduction to the Java EE Platform

ProcedureCreating the FirstcupUser Entity Class

The FirstcupUser Java Persistence API entity represents a particular firstcup user, and stores the user's birthday and the difference in age between the user and Duke. FirstcupUser also defines a Java Persistence API query used to calculate the average age difference of all users.

  1. With the firstcup project selected in the Projects pane, select File -> New File.

  2. Under Categories select Persistence, then under File Types select Entity Class, and click Next.

  3. Enter FirstcupUser under Class Name and firstcup.entity under Package.

  4. Click Create Persistence Unit, select jdbc/__default under Data Source, and click Create.

  5. Click Finish.