Manage persistence configuration file with JPA Persistence Configuration Editor
The persistence.xml file defines the context for JPA persistence. The ORM Workbench
provides a graphical interface for editing the persistence.xml file. You can
edit the persistence configuration file by right-clicking JPA Configuration,
then 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 AppXplorer.
The persistence.xml file is located at this path in your project hierarchy:
web\WEB-INF\src\java\META-INF
The JPA Persistence Configuration Manager is organized in four category tabs:
Connection — Edit the database connection information.
Mappings — Edit information about mapped classes.
Properties — Edit vendor-specific properties.
Source — Edit the persistence.xml source directly.
Specify the Connection properties
The Connection tab displays the current connection properties
and the ability to modify the existing connection. To update the BEA Kodo
connection information, click the Edit Connection Properties
option.
By clicking Populate from existing connection, you can
use a connection that you've already set up using DbXplorer. Note that if
requested, Workshop Studio will copy the database driver library and add it
to your classpath, where it will be available to your persistence code.
Specify JPA mapping files
Click the Mappings tab in JPA Configuration Editor. The
editor displays the list of Mapped Classes.
To edit JPA entity beans using the Mappings tab select a mapped class from
the list and the editor displays the corresponding Mapped Class Properties.
Click the Class Name link to view the source code for the selected mapped
class.
The editor also allows you to add a new mapped class by clicking the New
Mapped Class button and browse to the class.
Specify Configuration Properties
In the JPA Configurations Editor, the Properties tab displays
the current JPA configuration properties and their values through the form editor.
Click the Properties tab in the JPA Configurations Editor.
Selecting a configuration property will display the Configuration Property
name and value, allowing you to edit them.
To add additional properties, click the New Property button
and specify the Name and Value or click the
button to browse through a list of properties. The Select Property dialog
displays all the list of Kodo properties with a description.
Understand validation and code completion facility
The AppXRay provides validation and code completion in the
JPA Configurations Editor. When you're editing in the Source tab, you're helped
by code completion.
Switch to the Source tab of the JPA Configurations Editor.
Edit the value of Class Name attribute of Mapped
Class in the Smart Editor to com.bea.beans.Customer_New.
As we have specified an invalid mapping file which does not exist either
in project or at the specified location, the Editor shows a warning. Reset
the value of Class Name attribute of Mapped Class
in smart editor to com.bea.beans.Customer. Save
persistence.xml.
When you're editing in the Source tab, you're helped by code completion
when you press CTRL+SPACE.
You can create a new child element of <persistence-unit> as shown
below.
Similarly you can add a new <property> element as shown below. The
code completion feature of AppXRay displays a list of Kodo properties.
Click one of the following arrows to navigate through the tutorial: