Skip Headers

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

Previous | Next |

# Configuring a Primary Mapping Project

The mapping project contains your TopLink mapping metadata (see "Understanding Projects"), including descriptors and mappings. Each session is associated with at least one project so that the session can register the descriptors.

Table 77-3 summarizes which sessions support a primary mapping project configuration.

Table 77-3 Session Support for Primary Mapping Project

Session | Using TopLink Workbench | Using Java
--- | --- | ---
Server and Client Sessions |  |
Session Broker and Client Sessions |  |
Database Sessions |  |

Using TopLink Workbench, you can export your mapping metadata as either a deployment (Extensible Markup Language) XML file or as a Java class. Consequently, in a session, you can specify the mapping project as an XML file or as a Java class.

- Oracle recommends that you export your mapping metadata from TopLink Workbench as a deployment XML file (see "Exporting Project Information").

- If you export your mapping metadata as a Java class, you must compile it and add it to the session configuration classpath (see "Configuring a Sessions Configuration") before adding it to a session.

See "Configuring Multiple Mapping Projects" for information on configuring additional TopLink projects for the session.

## Using TopLink Workbench

To specify the primary TopLink project metadata for your session, use this procedure:

1. Select a server or database session in the Navigator. Its properties appear in the Editor.

2. Click the General tab. The General tab appears.

3. Click the Project subtab. The Project subtab appears.

   Figure 77-1 General Tab, Project Subtab, Primary Project Option

   Description of "Figure 77-1 General Tab, Project Subtab, Primary Project Option"

4. Select the following options:

   - Click Edit to define the primary project. The Edit PrimaryProject dialog box appears.

   - Select the Multiple Projects option to add additional projects to the session. See "Configuring Multiple Mapping Projects" for more information.

   Figure 77-2 Edit Primary Project Dialog Box

   Description of "Figure 77-2 Edit Primary Project Dialog Box"

5. Complete each field on the Edit Primary Project dialog box.

Use this information to enter date in each field on the dialog box:

Field | Description
--- | ---
XML | Select XML to add a mapping project as a deployment XML file. Click Browse to select the file.
Class | Select Class to add a mapping project as a compiled Java class file. Click Browse to select the file.

## Using Java

Using Java, you can register descriptors with a session using the following:

- `Project` API–Read your `project.xml` file (or instantiate your project class) and create your session using `Project` method `createServerSession` or `createDatabaseSession`.

- `Session` API–Add a descriptor or set of descriptors to a session using the `Session` API that Table 77-4 lists. Descriptors should be registered before login, but independent sets of descriptors can be added after login.

Table 77-4 Session API for Registering Descriptors

Session Method | Description
--- | ---
`addDescriptors(Project)` | Add to the session all the descriptors owned by the passed in `Project`.
`addDescriptors(Vector)` | Add to the session all the descriptors in the passed in `Vector`.
`addDescriptor(Descriptor)` | Add an individual descriptor to the session.