Adding persistence to a Java project


Use this procedure to add persistence to an existing project:

  1. Right-click the project in the Package Explorer and select Java Persistence > Add Java Persistence.

    Adding Persistence to a Project

    Using the Java Persistence > Add Java Persistence menu option.
  2. Complete the fields in the Add Persistence dialog to select a database connection and persistence packaging options.

    • To create a new database connection, click Add Connections use the New Connection wizard.

    • To add the libraries that contain the JPA (Java Persistence API), click Build Path and use the Java Build Path page of the project's properties.

    • To package your persistent project, select the Create persistence.xml option and complete the fields in the Packaging Settings area. See "Managing the persistence.xml file" for more information.

    Add Java Persistence Dialog

    The Add Persistence dialog.
  3. Click Finish. You should now open the Persistence perspective.

 

Related reference

Add Persistence dialog
Persistence perspective

 

Related tasks

Managing the persistence.xml file
Adding persistence to a class
Creating a new Java persistent entity

 

Related concept

Understanding Java persistence
The persistence.xml file