Add persistence to the project |
Use this procedure to add persistence to the Employee project.
Right-click the Employee project in the Explorer and select Java Persistence > Add Java Persistence. The Add Java Persistence Dialog appears.
In the Database Settings area select a database connection that you created earlier (see "Create a database connection").
You must be connected to the database before adding persistence to the project.
Click Configure the project build path to add the library or JARs that contain the Java Persistence API (JPA) and entities to the project's Java Build Path.
In the Packaging Settings area select the Create persistence.xml option and complete the following fields:
Persistence Version: 1.0
Persistence Provider: Enter the name of the JPA provider that you selected in step 3 (such as TopLink Essentials).
Persistence Unit Name: Dali Tutorial
Click Finish. You can now work in the Persistence perspective.
Select Window > Open Perspective > Other. The Select Perspective dialog appears.
Select Persistence and click OK. The Persistence Outline and Properties views appear.
The next step is to Create persistent Java entities.