| By Pieter Humphrey | Article Rating: |
|
| July 21, 2010 10:45 AM EDT | Reads: |
1,896 |
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 1,896
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.
- Top Ten Performance Problems
- It's the Java vs. C++ Shootout Revisited!
- Open Letter to the President of Syria Bashar al-Assad
- OpenSolaris Board Quits En Masse
- Cloud Computing, SOA and Windows Azure
- IBM’s Dustin Amrhein to Present at Cloud Expo Silicon Valley
- Jinfonet Announces JReport 10
- Cloud Expo Silicon Valley: Analytics for Enterprises Using Private Cloud
- Enterprise Applications are Good Candidates for Using JavaFX
- HP and Dell to Sell Solaris; OpenSolaris Hung Out to Dry
- Oracle Kills OpenSolaris
- The Unofficial History of Java Applets
- Top Ten Performance Problems
- Oracle Surviving Sun Just Fine, Thank You
- It's the Java vs. C++ Shootout Revisited!
- Open Letter to the President of Syria Bashar al-Assad
- OpenSolaris Board Quits En Masse
- Managing Persistent Entities with the JPA Persistence Entity Editor
- Cloud Computing, SOA and Windows Azure
- IBM’s Dustin Amrhein to Present at Cloud Expo Silicon Valley
- Jinfonet Announces JReport 10
- Cloud Expo Silicon Valley: Analytics for Enterprises Using Private Cloud
- Enterprise Applications are Good Candidates for Using JavaFX
- HP and Dell to Sell Solaris; OpenSolaris Hung Out to Dry
- A Cup of AJAX? Nay, Just Regular Java Please
- Java Developer's Journal Exclusive: 2006 "JDJ Editors' Choice" Awards
- The i-Technology Right Stuff
- JavaServer Faces (JSF) vs Struts
- Rich Internet Applications with Adobe Flex 2 and Java
- Java vs C++ "Shootout" Revisited
- Bean-Managed Persistence Using a Proxy List
- Reporting Made Easy with JasperReports and Hibernate
- Creating a Pet Store Application with JavaServer Faces, Spring, and Hibernate
- What's New in Eclipse?
- Why Do 'Cool Kids' Choose Ruby or PHP to Build Websites Instead of Java?
- i-Technology Predictions for 2007: Where's It All Headed?
























