Adding persistence to a Java project |
Use this procedure to add persistence to an existing project:
Right-click the project in the Package Explorer and select Java Persistence > Add Java Persistence.
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.
Click Finish. You should now open the Persistence perspective.
persistence.xml
file