## Refactoring Persistent Types and Attribute Types

Caution:

- If you rename or move a persistent type using a different approach (for example, via the Project Explorer), the persistent type disappears from the JPA diagram.

- When you refactor an attribute type, any existing business logic within the attribute's access methods is deleted.

## Overview

Using the JPA diagram editor, you can perform the following refactoring operations:

- Rename the persistent type class: from the context menu of the persistent type name, choose Refactor Persistent Type Class → Rename , and then complete the wizard.

- Move the persistent type to another source package: from the context menu of the persistent type name, choose Refactor Persistent Type Class → Move , and then complete the wizard.

- Refactor an attribute type: from the context menu of an attribute, choose Refactor Attribute Type, change the type, and then choose OK.

## Viewing and Editing the Source Code of Persistent Types

To view and edit the source code of a particular persistent type, double-click on the title of the corresponding persistent type block on the diagram.

The Eclipse IDE opens the persistent type class in the standard source code editor.

When you apply changes to the source code, they are automatically synchronized with the diagram.

## Removing All Persistent Types from a Diagram

Note: This operation removes the persistent types from the JPA diagram only, that is, they are not removed from the underlying application data model.

1. Click upon the JPA diagram with the secondary mouse button.

2. To save any unsaved changes to the application data model, and remove all persistent types from the diagram, choose Remove all Persistent Types from Diagram → ...and Save Changes

3. To remove all persistent types from the diagram without saving any unsaved changes to the data model, choose Remove all Persistent Types from Diagram → ...and Discard Changes .