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 Classes

This section describes how to create descriptors from Java classes and packages and includes information on the following:

Creating Classes

Use this procedure to create new classes and packages from within the OracleAS TopLink Mapping Workbench.

To Create a New Class:

  1. Right-click the project in the Navigator pane and choose Create New Class from the pop-up menu.

    You can also choose Selected > Create New Class from the menu.

  2. Use the Package Name drop-down list to choose a package or enter a new package name.

  3. In the New Class Name field enter a class name and click OK. The OracleAS TopLink Mapping Workbench adds the new class to your project in the Navigator pane.


    Note:

    The Class Name must be unique within the package.

Updating Classes

Use this procedure to update or refresh the classes in the OracleAS TopLink Mapping Workbench project.


Note:

If the class exists on both the system classpath and the project classpath, the OracleAS TopLink Mapping Workbench will update the class from the system classpath. To update or refresh from the project classpath, remove the class from the system classpath and restart the OracleAS TopLink Mapping Workbench.

To Update Classes:

  1. Define the available class(es) and package(s) for the project on the General tab. See "Working with General Project Properties" for information on classes and packages.

  2. Add/Refresh Class button.
    Description of the illustration creatcls.gif

    Click on Add/Refresh Class button. The Select Classes dialog box appears.

    You can also update the classes by choosing Selected > Add/Refresh Classes from the menu.

    Figure 2-10 Select Classes

    Description of select.gif follows
    Description of the illustration select.gif

  3. Select the package(s) and/or class(es) to add to the project and click OK. The OracleAS TopLink Mapping Workbench adds the new classes to your project in the Navigator pane.


    Note:

    The OracleAS TopLink Mapping Workbench creates class descriptors for each package/class. See "Specifying Descriptor Types" on page 4-2 for to change the descriptor type.

To Remove a Class from a Project:

Remove Class button.
Description of the illustration remclass.gif

Select on the descriptor and click the Remove Class button, or choose Selected > Remove Class from the menu.


Note:

If you change a descriptor to an interface or abstract class in code (outside of OracleAS TopLink Mapping Workbench), and then refresh the class in OracleAS TopLink Mapping Workbench, you may receive an ExternalClassNotFoundException.

For example: A project contains two descriptors: Employee and EmployeeInterface. Both are classes and Employee extends EmployeeInterface. Outside of OracleAS TopLink Mapping Workbench you edit the EmployeeInterface code to change it to an interface and make Employee implement the interface. When you refresh the classes in OracleAS TopLink Mapping Workbench, you will receive the error.

To avoid this situation, refresh EmployeeInterface first, then refresh Employee.


Refreshing Descriptors with Dependent Classes

If you refresh a descriptor, the OracleAS TopLink Mapping Workbench does not refresh dependent classes if they are not included in the OracleAS TopLink Mapping Workbench project.

For example, if you define a descriptor with an after load class and method which is not included in the OracleAS TopLink Mapping Workbench project and you change the after load class outside of the OracleAS TopLink Mapping Workbench, when you refresh the descriptor, the OracleAS TopLink Mapping Workbench does not pick up the change.

To work around this issue, add all dependent classes to the OracleAS TopLink Mapping Workbench project. Because you do not map them, right-click each dependent class and uncheck the Activate Descriptor option. When you refresh the project, the OracleAS TopLink Mapping Workbench refreshes both descriptors and dependent classes.