Skip Headers

Oracle TopLink Developer's Guide 10g Release 3 (10.1.3) B13593-01 |
| Home | Solution Area | Contents | Index

Previous | Next |

# Configuring Persistence Type

You can configure your project persistence type only when using TopLink Workbench.

Using TopLink Workbench, you can specify the persistence type to use with the project. For example, your TopLink project may use plain Java objects, entity beans with CMP, or entity beans with bean-managed persistence (BMP).

Table 22-6 summarizes which projects support a persistence type configuration.

Table 22-6 Project Support for Persistence Type

Descriptor | Using TopLink Workbench | Using Java
--- | --- | ---
Relational Projects |  |
EIS Projects |  |
XML Projects |  |

To create a TopLink descriptor for a persistent class, TopLink Workbench reads a compiled Java `.class` file to read its attributes and relationships. See "Descriptors" for more information on TopLink descriptors.

For EJB projects, you can specify an `ejb-jar.xml` file from which TopLink will read and write the necessary persistence information. You use the `ejb-jar.xml` file to map the virtual fields of the EJB 2.0 CMP entity beans (called container-managed fields, defined by `<cmp-field>` tag) or relationships (called container-managed relationship, defined by `<cmr-field>` tag) to a data source.

TopLink Workbench defines all descriptors for entity classes (as defined in the `ejb-jar.xml` file) as EJB descriptors. TopLink Workbench does not create (or remove) descriptors for the interfaces and primary key class for the entity when refreshing from the `ejb-jar.xml` file.

Note: TopLink Workbench creates class descriptors for entity classes not defined in the `ejb-jar.xml` file. You must manually change the descriptor type (see "Configuring a Descriptor With EJB Information").

To update your project from the XML file, right-click an EJB descriptor and select Update Descriptors from ejb-jar.xml. You can also update the project by choosing Selected > Update Descriptors from ebj-jar.xml from the menu.

For more information on creating and using deployment files such as the `ejb-jar.xml` file, see the following:

- "Understanding TopLink Deployment File Creation"

- "Integrating TopLink With an Application Server ``"

- "Packaging a TopLink Application"

- "Deploying a TopLink Application"

## Using TopLink Workbench

To specify the persistence information, use this procedure:

1. Select the project object in the Navigator.

2. Select the General tab in the Editor. The General tab appears.

   Figure 22-4 General Tab, Persistence Options

   Description of "Figure 22-4 General Tab, Persistence Options"

Use this table to enter data in the following fields on the project's General tab to configure the persistence options:

Field | Description
--- | ---
Persistence Type | Specify the persistence type of the project: Java Objects, CMP 1.x, CMP 2.x, or BMP. For EJB projects, specify the location of the `ejb-jar.xml` file. Note: This field does not apply to XML projects.
Location of ejb-jar.xml | Specify the location of the `ejb-jar.xml` file for this project. "Working With the ejb-jar.xml File" for more information. Note: This field applies to EJB projects only.