Step 5. Exploring Persistence Settings
Time to complete this step: 15 minutes
The persistence.xml file defines the context for JPA persistence. In
this step, you will use the JPA Persistence Configuration Editor to
explore the persistence.xml file for your JPA web project.
The task in this step are:
To Use the JPA Persistence Configuration Editor to View the Persistence Configuration File
The JPA Persistence Configuration Editor provides a graphical
interface that allows you to modify connection information, mapped
classes, and JPA properties that are managed by your persistence.xml
file. Optionally, you can also use the editor to edit the
persistence.xml source file.
- From the Project Explorer, open the JPA Persistence Configuration Editor by right-clicking persistence.xml and selecting Open. This will open the persistence.xml configuration
file in the JPA Persistence Configuration Editor.
- You can also open the persistence.xml file by double-clicking it in Project Explorer.
The persistence.xml file is located at this path in your project hierarchy:
web\WEB-INF\src\java\META-INF

- The JPA Persistence Configuration Editor is organized in four category tabs:
- Connection — Edit the database connection information.
- General — Edit information about managed classes and the persistence provider unit.
- Properties — Edit vendor-specific and general properties.
- Source — Edit the persistence.xml source directly.
To View the Connection Properties
The Connection tab of the persistence.xml editor displays the current connection properties
and allows you to modify the existing connection if you use a JDBC Datasource. If you choose to instead embed the connection properties directly in persistence.xml, you can use the Properties tab to edit them. This tutorial embeds the properties directly.
- To view or update the Open JPA
connection information, click the Properties tab of the persistence.xml editor.

To View JPA Mapping Files
You can use the General tab to view and modify mapped classes.
- Click the General tab in the JPA Configuration Editor.
The "Managed Classes" section of the editor displays the list of managed classes in the persistence unit.
- To edit the JPA entity beans, select a mapped class
from the list and click Open to view the source code for the selected mapped
class.
- The editor also allows you to add a new mapped class by clicking Add... and browsing to the class.


Click one of the following arrows to navigate through the tutorial: