| By Pieter Humphrey | Article Rating: |
|
| June 12, 2010 11:00 AM EDT | Reads: |
9,366 |
Oracle Enterprise Pack for Eclipse 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.
The tasks you will complete in this step are:
- View an entity relationship diagram, using the Entity Editor
- View the properties of JPA persistent entities, using the Entity Editor and the JPA Details View
- Manage JPA entity mappings
View an Entity Relationship Diagram, Using the Entity Editor
As described previously, the Entity Editor displays relationship diagrams for entities defined in the project.
- In the Project Explorer view, expand oepe-jpa-tutorial > JPA >Show in Entity Editor. Oracle Enterprise Pack for Eclipse provides a list of entities under the Entities branch based on the entities defined in the Persistence configurations file.
The JPA Persistence Entity Editor displays all entity relationships defined in the Web application. Each box displays a specific entity, its properties, and an icon denoting the nature of the relationship.
- The JPA Persistence Entity Editor displays and selects property types for an entity by using tool tip popups. You can work with entity relationship diagrams by selecting operations such as Zoom In, Zoom Out, Export to Image, and Print. To view a tool tip, hover your cursor over the respective entity. To view and edit the details, use the JPA Details View.
The JPA Persistence Entity Editor also allows you to filter relationships between entities. This feature helps you simplify your view of the diagram when it is large and complex.
- Click Filters and select the options Many to One and One to Many to filter which entity relationships are noted in the diagram.
- Reset both filters.
View and Edit JPA Persistent Entities, Using the Entity Editor
Using the JPA Details View, you can easily edit entity properties.
- Select the Contact entity in the JPA Entity Editor.
- Click the Properties tab to view the JPA Details view. The JPA Details View displays the properties for the Contact entity.
- With the JPA Details view, you can edit the associated Java Bean class, strategy for persistence, and the database access information for the selected entity. To edit, either enter text in the text box or click on the dropdown lists for the schema binding, Primary Key Generation, Sequence Generators, Queries, etc.
- In the JPA Persistence Entity Editor, select the phone property of the Contact entity. The JPA Details view displays properties of the phone property. Observe the properties.
- Use the JPA Details view to modify the Length of phone property. For example:
- Set Nullable to false
- Update the Length value from 20 to 25
- Press CTRL+S to save the changes.
- Within the JPA Entity Editor, right-click the entity Contact to view its source code or see the associated configuration in persistence.xml.
Manage JPA Entity Mappings
The following describes how the annotations are translated into what the JPA Details view displays. When the JPA Details view displays an underlined label, you can click the label to view the corresponding Java source code or item in the Data Source Explorer.
- In the JPA Entity Editor, review the many-to-one association between OrderData and Customer. Select the customer property OrderData entity to view its properties in the JPA Details view.
- Within the JPA Details view, examine the Join Columns. Select the association and click Edit to edit the mapping association.
Click Cancel.
- Next, locate the one-to-many association between OrderData and Lineitems.
Click on the lineitems property in the OrderData entity and view Target Entity and Mapped By properties in the JPA Details View.
- Clicking Target Entity in the JPA Details View will take you to the class for the related entity type Lineitem.
- Close the LineItem.java file.
- Clicking Mapped By under the Join Properties will allow you to change the field by which the many-to-one association of OrderData to Lineitem is mapped. Do not make any changes at this time.
- Close the LineItem.java file.
In Part 5 I will explore persistence settings.
Published June 12, 2010 Reads 9,366
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.
- Acquia Announces Two New Board Members
- CollabNet Adds Board Member and Senior Executives to Fuel Continued Growth in Agile ALM and Enterprise Cloud Development
- Learn Open Source Database Tools from Stanford for Free
- Research and Markets: Global Mobile Device Management Enterprise Software Market 2010-2014 Includes a Discussion of the Key Vendors Operating in This Market
- Alternative Search Engines for the Contemporary User
- FORTUNE Magazine Names Rackspace Among “100 Best Companies to Work For”
- New York City : Blueprint for Cloud-enabled economic transformation
- EnterpriseDB Announces Availability of Postgres Plus Cloud Database
- Connectria Hosting Achieves "Off the Chart" Operational Efficiency With Cloud-Based Storage Solution From Nexsan and CommVault
- eXo Platform 3.5 Now Available: First Cloud-Ready Enterprise Portal and User Experience Platform-as-a-Service (UXPaaS)
- Research and Markets: WordPress 24-Hour Trainer, 2nd Edition
- ICOS and Joyent Announce Strategic Partnership to Deliver Joyent's Cloud Infrastructure Solution to Channel Partners and Service Providers
- Five Years Waiting for JRE 7: Is It Justified? (Part 1)
- Book Review: The CERT Oracle Secure Coding Standard for Java
- Acquia Announces Two New Board Members
- CollabNet Adds Board Member and Senior Executives to Fuel Continued Growth in Agile ALM and Enterprise Cloud Development
- Learn Open Source Database Tools from Stanford for Free
- Research and Markets: Global Mobile Device Management Enterprise Software Market 2010-2014 Includes a Discussion of the Key Vendors Operating in This Market
- Government Big Data Solutions Award Nominee: Wayne Wheeles (Sherpa Surfing)
- Alternative Search Engines for the Contemporary User
- FORTUNE Magazine Names Rackspace Among “100 Best Companies to Work For”
- New York City : Blueprint for Cloud-enabled economic transformation
- EnterpriseDB Announces Availability of Postgres Plus Cloud Database
- Load testing the post office
- 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
- "Eclipse 3.0 is a Great Leap Forward," Says JDJ's Dudney
- The Top 250 Players in the Cloud Computing Ecosystem
- Developing an Eclipse BIRT Report Item Extension






















