| By Pieter Humphrey | Article Rating: |
|
| July 21, 2010 10:45 AM EDT | Reads: |
6,096 |
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,096
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.
- Book Excerpt: Introducing HTML5
- It's the Java vs. C++ Shootout Revisited!
- Patterns for Building High Performance Applications
- OpenXava 4.3: Rapid Java Web Development
- Asynchronous Logging Using Spring
- Java for Programmers (2nd Edition)
- Cross-Platform Mobile Website Development – a Tool Comparison
- Write Once Run Anywhere or Cross Platform Mobile Development Tools
- Three Buzzwords That Every CIO Hears but One They Should Listen To
- Immersing into JavaScript Frameworks
- Workday Reportedly Prepping to Go Public
- Book Review: Sams Teach Yourself Java in 24 Hours
- Book Excerpt: Introducing HTML5
- Adobe Sends Flex to the Apache Foundation
- Five Years Waiting for JRE 7: Is It Justified? (Part 1)
- Book Excerpt: Java Application Profiling Tips and Tricks
- i-Technology in 2012: Five Industry Predictions
- It's the Java vs. C++ Shootout Revisited!
- Patterns for Building High Performance Applications
- OpenXava 4.3: Rapid Java Web Development
- The Next Web Architecture
- Asynchronous Logging Using Spring
- Java for Programmers (2nd Edition)
- Is Write Once Run Anywhere Ever Going to Be a Reality?
- A Cup of AJAX? Nay, Just Regular Java Please
- Java Developer's Journal Exclusive: 2006 "JDJ Editors' Choice" Awards
- JavaServer Faces (JSF) vs Struts
- The i-Technology Right Stuff
- 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
- Why Do 'Cool Kids' Choose Ruby or PHP to Build Websites Instead of Java?
- What's New in Eclipse?
- i-Technology Predictions for 2007: Where's It All Headed?





















