Digital Edition

SYS-CON.TV
Managing Persistent Entities with the JPA Persistence Entity Editor
Part 4 - The Entity Editor provides a centralized view of all entity relationships

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
As described previously, the Entity Editor displays relationship diagrams for entities defined in the project.

  1. 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.

  1. 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.

  1. Click Filters and select the options Many to One and One to Many to filter which entity relationships are noted in the diagram.

  1. Reset both filters.

View and Edit JPA Persistent Entities, Using the Entity Editor
Using the JPA Details View, you can easily edit entity properties.

  1. Select the Contact entity in the JPA Entity Editor.
  2. Click the Properties tab to view the JPA Details view. The JPA Details View displays the properties for the Contact entity.

  1. 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.
  2. 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.
  3. 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.

  1. 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.

  1. 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.

  1. Within the JPA Details view, examine the Join Columns. Select the association and click Edit to edit the mapping association.
    Click Cancel.
  1. 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.
  2. Clicking Target Entity in the JPA Details View will take you to the class for the related entity type Lineitem.
  3. Close the LineItem.java file.
  4. 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.

  1. Close the LineItem.java file.

In Part 5 I will explore persistence settings.

About 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.

In order to post a comment you need to be registered and logged in.

Register | Sign-in

Reader Feedback: Page 1 of 1



ADS BY GOOGLE
Subscribe to the World's Most Powerful Newsletters

ADS BY GOOGLE

Containers and Kubernetes allow for code portability across on-premise VMs, bare metal, or multiple ...
Everyone wants the rainbow - reduced IT costs, scalability, continuity, flexibility, manageability, ...
SYS-CON Events announced today that Silicon India has been named “Media Sponsor” of SYS-CON's 21st I...
We are seeing a major migration of enterprises applications to the cloud. As cloud and business use ...
Founded in 2000, Chetu Inc. is a global provider of customized software development solutions and IT...
SYS-CON Events announced today that CrowdReviews.com has been named “Media Sponsor” of SYS-CON's 22n...
DXWorldEXPO LLC announced today that "IoT Now" was named media sponsor of CloudEXPO | DXWorldEXPO 20...
Andi Mann, Chief Technology Advocate at Splunk, is an accomplished digital business executive with e...
Most DevOps journeys involve several phases of maturity. Research shows that the inflection point wh...
DXWorldEXPO LLC announced today that ICOHOLDER named "Media Sponsor" of Miami Blockchain Event by Fi...
Today, we have more data to manage than ever. We also have better algorithms that help us access our...
DXWordEXPO New York 2018, colocated with CloudEXPO New York 2018 will be held November 11-13, 2018, ...
DevOpsSummit New York 2018, colocated with CloudEXPO | DXWorldEXPO New York 2018 will be held Novemb...
@DevOpsSummit at Cloud Expo, taking place November 12-13 in New York City, NY, is co-located with 22...
Bill Schmarzo, author of "Big Data: Understanding How Data Powers Big Business" and "Big Data MBA: D...
CI/CD is conceptually straightforward, yet often technically intricate to implement since it require...
The now mainstream platform changes stemming from the first Internet boom brought many changes but d...
Bill Schmarzo, Tech Chair of "Big Data | Analytics" of upcoming CloudEXPO | DXWorldEXPO New York (No...
CloudEXPO New York 2018, colocated with DXWorldEXPO New York 2018 will be held November 11-13, 2018,...
SYS-CON Events announced today that IoT Global Network has been named “Media Sponsor” of SYS-CON's @...