Working with persistence units (persistence.xml)

You can edit the persistence.xml file with the Persistence XML Editor.

About this task

The persistence.xml file describes the details of the persistence units in your JPA project. A persistence unit contains a list of entity beans.

The Persistence XML editor simplifies making changes to the persistence.xml file:

  • Add and remove persistence units.
  • Modify the properties of a persistence unit.
  • Add and remove classes in a persistence unit.
  • Add and remove properties in a persistence unit.
Tip: For projects with JPA version 2.1, consult the Eclipse persistence.xml Editor.

The persistence.xml file is in the META-INF directory of the JPA project.

To edit the persistence.xml file, complete the following steps.

Procedure

  1. In the Package Explorer view, right-click the persistence.xml file of the JPA project that you want to edit and select Open with > Persistence XML Editor.
  2. In the Design tab of the Persistence XML Editor, make any of the following changes to the persistence.xml file:
    • Add or remove persistence units.
    • Modify the persistence unit details.
    • Add or remove classes for a persistence unit.
    • Add or remove additional properties of a persistence unit.
  3. Click File > Save to save your changes.