Skip Headers

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

Previous | Next |

# Step 1: Creating a Project

In this step, you will create a relational TopLink project mapped to a relational database. In addition to relational projects, TopLink can create other kinds of nonrelational projects mapped to EIS data sources or XML Schema-based XML documents.

## TopLink Workbench Project

To create a new TopLink Workbench project, use this procedure:

1. Start TopLink Workbench by executing the `workbench` script in `<TOPLINK_HOME>\bin`. For windows, select the `workbench.cmd` file. For UNIX, select the `workbench.sh` file.

2. Click New on the toolbar and select Project. The Create New TopLink Workbench Project dialog box appears.

   You can also create a new project by choosing File > New > Project from the menu.

   Figure 17-1 Create New TopLink Workbench Project Dialog Box

   Description of "Figure 17-1 Create New TopLink Workbench Project Dialog Box"

3. In the Name field, type Employee.

4. Select Database as the Data Source, then use the Platform field to select your specific database platform.

5. Click OK. TopLink Workbench creates the new project.

   Figure 17-2 TopLink Workbench

   Description of "Figure 17-2 TopLink Workbench"

   The tutorial project uses Java Objects as the persistence type. TopLink Workbench places an asterisk ( * ) beside the project name in the Navigator, indicating that you have not yet saved the project.

6. Click Save on the toolbar. TopLink Workbench prompts for a directory location.

7. Select the `<TUTORIAL_HOME>\mw` directory, and click OK.

   When you create a new TopLink Workbench project, always save it in an empty directory.

## Adding Java Classes

After creating the empty Employee project, you must add the compiled Java classes to the project's classpath.

1. Select the Employee project in the Navigator. Its properties appear in the Editor.

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

   Figure 17-3 General Tab

   Description of "Figure 17-3 General Tab"

3. In the Classpath area, click Browse. The Add Entries dialog box appears.

4. Select the `<TUTORIAL_HOME>\servletjsp.jar` that contains the compiled classes for this tutorial and click OK. TopLink Workbench adds the JAR file to the project's classpath.

   For information on these classes, See "Source Files".

5. Click Add or Refresh Classes to add the classes to the project. The Select Classes dialog box appears.

   Figure 17-4 Select Classes Dialog Box

   Description of "Figure 17-4 Select Classes Dialog Box"

6. Select the `examples.servletjsp.model` package and click Add Selected Classes To List. The package moves to the Selected Classes area.

   The other classes are used by the application at run time.

7. Click OK. TopLink Workbench adds the package to the project and creates TopLink descriptors for each Java class.

   Descriptors are TopLink representations of Java classes. Descriptors own the mappings that relate persistent attributes to database fields.

   Figure 17-5 TopLink Workbench

   Notice that TopLink Workbench alerts you that there are errors and unmapped attributes in the project. You will correct these errors as you map the tutorial project.

8. Click Save on the toolbar to save the project.