| By Pieter Humphrey | Article Rating: |
|
| July 21, 2010 10:45 AM EDT | Reads: |
6,520 |
In Part 4 I discussed the Oracle Enterprise Pack for Eclipse and how it allows you to view, create, and manage JPA entity relationships. The Entity Editor provides a centralized view of all entity relationships, allows you to modify entity properties, and allows you to navigate between the object model, mapping associations, and database schema layers.
In Part 5, I will explore persistence settings. 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.
In this step, you will:
- Use the JPA Persistence Configuration Editor to view the persistence configuration file
- View the connection properties
- View JPA mapping files
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 (see Figure 1).
- 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 (see Figure 2).
- 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 (see Figure 3)

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 (see Figure 4).
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 (see Figure 5 and 6).

In Step 6 I will demonstrate how to generate Spring ORM classes.
Published July 21, 2010 Reads 6,520
Copyright © 2010 SYS-CON Media, Inc. — All Rights Reserved.
Syndicated stories and blog feeds, all rights reserved by the author.
More Stories By Pieter Humphrey
Pieter Humphrey has been at Oracle (by way of BEA Systems) for 7+ years, working in development, marketing, sales, and developer relations to advance Java technology in the enterprise. He ran the dev2dev community at BEA and continues to with work with Oracle OTN and Eclipse Foundation communities. His current role is focused on application development tools like Oracle Enterprise Eclipse Pack, Oracle Workshop for WebLogic, JDeveloper, TopLink and the ADF framework, and is a frequent speaker at industry events and workshops.
- Eighteen Open Source Content Management Systems (Part 3)
- OpenNebula: Open Source Cloud Management
- The Java Courseware
- Book Excerpt: Java Application Architecture
- Amazon Partners with Eucalyptus
- IBM Puts All Its Experience in a Box
- EMC Buys Pivotal Labs
- Hot Tech Firms at the 2012 DoDIIS Conference
- IBM Buying Varicent Software
- Eucalyptus Gets $30 Million C Round
- HTC Licenses Intertrust Patents, Takes 20% of SyncTV
- Opscode Gets $19.5 Million Round
- Red Hat Executive Appointed to Technology Services Industry Association (TSIA) Support Services Advisory Board
- Eighteen Open Source Content Management Systems (Part 3)
- OpenNebula: Open Source Cloud Management
- The Java Courseware
- Book Excerpt: Java Application Architecture
- Amazon Partners with Eucalyptus
- IBM Puts All Its Experience in a Box
- EMC Buys Pivotal Labs
- Hot Tech Firms at the 2012 DoDIIS Conference
- IBM Buying Varicent Software
- Eucalyptus Gets $30 Million C Round
- HTC Licenses Intertrust Patents, Takes 20% of SyncTV
- Java Developer's Journal Exclusive: 2006 "JDJ Editors' Choice" Awards
- The i-Technology Right Stuff
- Creating Web Applications with the Eclipse Web Tools Project
- Eclipse Special: Remote Debugging Tomcat & JBoss Apps with Eclipse
- The Next Programming Models, RIAs and Composite Applications
- Where Are RIA Technologies Headed in 2008?
- SYS-CON Webcast: Eclipse IDE for Students, Useful Eclipse Tips & Tricks
- How to Bring Eclipse 3.1, J2SE 5.0, and Tomcat 5.0 Together
- Eclipse: The Story of Web Tools Platform 0.7
- The Top 250 Players in the Cloud Computing Ecosystem
- "Eclipse 3.0 is a Great Leap Forward," Says JDJ's Dudney
- Developing an Eclipse BIRT Report Item Extension




















