Skip Headers
Oracle® Application Server TopLink Mapping Workbench User's Guide
10g Release 2 (10.1.2)
Part No. B15900-01
  Go To Documentation Library
Home
Go To Product List
Solution Area
Go To Table Of Contents
Contents
Go To Index
Index

Previous
Previous
Next
Next
 

Working with the ejb-jar.xml File

For OracleAS TopLink Mapping Workbench projects that use EJB 2.0 CMP persistence, use the ejb-jar.xml file to store persistence information for the application server. With the OracleAS TopLink Mapping Workbench, you can import information from an existing ejb-jar.xml file into your project, or you can create/update the ejb-jar.xml from your project.

Each OracleAS TopLink Mapping Workbench project uses a single ejb-jar.xml file. For each entity from the file, you should have an EJB descriptor in the project. All entities must use the same persistence type.

As you make changes in your project, you can update the ejb-jar.xml file to reflect your project. Additionally, if you edit the ejb-jar.xml file outside the OracleAS TopLink Mapping Workbench, you can update your project to reflect the current file.

Table 2–1 describes how fields in the ejb-jar.xml file correspond to specific functions in the OracleAS TopLink Mapping Workbench:

Table 2-1 ejb-jar.xml Fields and the OracleAS TopLink Mapping Workbench

ejb-jar.xml OracleAS TopLink Mapping Workbench
primkey Bean attribute mapped to the primary key in the database table (see "Setting Descriptor Information" on page 4-5)
ejb-name, prim-key-class, local, local-home, remote, home, and ejb-class EJB descriptor information on the EJB Info tab (see "Displaying EJB descriptor Information" on page 4-25)
abstract-schema-name Descriptor Alias field on the Name Queries tab (see "Named Queries" on page 4-14)
cmp-field Nonrelational attributes on the Descriptor Info tab (see "Setting Descriptor Information" on page 4-5)
cmp-version Persistence Type field on the General tab (see "Working with General Project Properties")

The persistence-type is set to container.

query Queries listed in Queries tab (see "Specifying Queries and Named Finders" on page 4-12)

Note: The findByPrimaryKey query is not in the ejb-jar.xml file, as per the EJB 2.0 specification.

relationships One-to-one, one-to-many, and many-to-many mappings (see "Working with Relationship Mappings" on page 6-2)

Writing to the ejb-jar.xml File

Use this procedure to update the ejb-jar.xml file, based on the current OracleAS TopLink Mapping Workbench information. Use the EJB preferences to specify whether the OracleAS TopLink Mapping Workbench automatically updates the ejb-jar.xml file when you save the project.


Note:

You can also write the information to a .jar file. The OracleAS TopLink Mapping Workbench automatically places the ejb-jar.xml file in the proper location (META-INF/ejb-jar.xml).

To Write the ejb-jar.xml File:

Choose Selected > Write Project to ejb-jar.xml from the menu. You can also right-click the project in the Navigator pane and choose Write Project to ejb-jar.xml from the pop-up menu.

  • If the project does not currently contain an ejb-jar.xml, the system prompts you to create a new file.

  • If the system detects that changes were made to the ejb-jar.xml file but not yet read into the OracleAS TopLink Mapping Workbench (for example, you changed the file outside the OracleAS TopLink Mapping Workbench), then the system prompts you to read the file before writing the changes.

Reading from the ejb-jar.xml File

Use this procedure to read the ejb-jar.xml information and update your OracleAS TopLink Mapping Workbench project.


Tip:

To automatically create EJB descriptors in the OracleAS TopLink Mapping Workbench for all entities, read the ejb-jar.xml file before adding any classes in the OracleAS TopLink Mapping Workbench.

To Read the ejb-jar.xml File:

Choose Selected > Update Project from ejb-jar.xml from the menu. You can also right-click the project in the Navigator pane and choose Update Project from ejb-jar.xml from the pop-up menu.