Create persistent Java entities |
The Tutorial Object Model contains three entities: Employee, Address, and PhoneNumber. Use this procedure to add the entities to the project.
Right-click the Employee project in the Package Explorer and select New > Class. The New Java Class dialog appears.
On the Java Class dialog, enter a package name (such as dali.tutorial.model
), class name (such as Employee
), and click Finish. Eclipse adds the Employee entity to the Package Explorer.
Select the Employee
entity in the JPA Structure view.
In the JPA Details view, in the Map As field, select Entity. In the Table field, select the EMPLOYEE database table.
Eclipse adds the @Entity
annotation to the class. Repeat this procedure to add the PhoneNumber and Address entities.
Notice that the Problems view reports several errors for each entity. We'll address these shortly.
Next, you will Add fields to the entities.