Oracle Application Server TopLink Mapping Workbench User's Guide 10g (9.0.4) Part Number B10316-01 |
|
When you create a descriptor for a class, the Oracle Application Server TopLink Mapping Workbench retrieves the table information from the database. This section includes information on:
Each OracleAS TopLink Mapping Workbench project contains a database. You can create multiple logins for each database. This section describes how to specify database properties and how to log into the database.
Use the Database property sheet to specify information about the database and login(s).
Field | Description |
---|---|
Database Platform |
Database platform for the project. Click Change to select a new database. |
Defined Logins |
Login used to access the database. Click Add to add a new login, or Remove to delete an existing login. |
Login Fields: |
To edit these fields, first select a Defined Login. |
The OracleAS TopLink Mapping Workbench connects to databases through JDBC. Contact your database administrator for information on installing and configuring your driver. |
|
Name required to log into the database. |
|
Password required to log into the database. Note: When exporting deployment XML and Java source (see "Exporting Project Information") the OracleAS TopLink Mapping Workbench writes out this password. Use the OracleAS TopLink Sessions Editor (see Chapter 8, "Understanding the OracleAS TopLink Sessions Editor") to specify password encryption options. |
|
Specify whether the OracleAS TopLink Mapping Workbench saves the Password for this Defined Login. |
|
The OracleAS TopLink Mapping Workbench supports multiple logins. Select a Defined Login to use for development and/or deployment. |
You must log into the database before importing or exporting table information.
Select the database object in the Navigator pane and click the Login button
on the toolbar. The OracleAS TopLink Mapping Workbench logs into the database. The database object in the Navigator pane changes to
.
You can also right-click on the database object and choose Log In from the pop-up menu or choose Selected > Log In from the menu.
Note: If you have not defined a login, the system displays a warning message. See "Database Properties" for more information on creating a database login. |
When you expand the database object in the Navigator pane, the OracleAS TopLink Mapping Workbench displays the database tables associated with the project. You can associate tables by importing them from the database or by creating them within the OracleAS TopLink Mapping Workbench.
Text description of the illustration dbtable.gif
Figure 3-2 calls out the following database icons.
Each database table property sheet contains the following tabs in the Editor pane:
Use this procedure to create a new database table within the OracleAS TopLink Mapping Workbench.
You can also right-click the database object and choose Add New Table from the pop-up menu or choose Selected > Add New Table from the menu.
Field | Description |
---|---|
Schema |
Use these fields to identify specific database information for the table. Consult your database administrator for more information. |
Table Name |
Name of this database table. |
Note: Refer to "Generating Tables on the Database" to add the table information to the database. |
Continue with "Working with Database Tables in the Editor Pane" to use these tables in your project.
The OracleAS TopLink Mapping Workbench can automatically read the schema for a database and import the table data into the project. This section describes the driver requirements and how to import, remove, and rename tables.
To retrieve table information from the database, the database driver must support the following JDBC methods:
You can also right-click on the database object in the Navigator and choose Add/Update Existing Tables from Database from the pop-up menu or choose Selected > Add/Update Existing Tables from Database from the menu.
Figure 3-4 calls out the following user-interface components:
Use this procedure to remove a database table from the project.
You can also right-click on the database object and choose Remove from the pop-up menu or choose Selected > Remove Table from the menu.
Use this procedure to rename a database table in the OracleAS TopLink Mapping Workbench project.
You can also select the table and choose Selected > Rename from the menu.
When you select a database table in the Navigator pane, its properties appear in the Editor pane. Each database table contains the following property tabs:
Use the database table's Field tab to specify properties for the database table's fields.
To remove a field, select the field and click Remove.
Use this procedure to set primary key(s) for a database table.
Note: The OracleAS TopLink Mapping Workbench can automatically import primary key information if supported by the JDBC driver. |
References are table properties that contain the foreign key -- they may or may not correspond to an actual constraint that exists on the database. The OracleAS TopLink Mapping Workbench uses these references when you define relationship mappings and multiple table associations.
When importing tables from the database (see "Importing Tables from Database"), the OracleAS TopLink Mapping Workbench can automatically create references (if the driver supports this), or you can define references from the workbench.
Use this procedure to create a new table reference.
Continue with Creating Field References.
Use this procedure to create a new field reference.
Text description of the illustration reftab.gif
Figure 3-8 calls out the following user-interface components:
The OracleAS TopLink Mapping Workbench can automatically generate the following information from the database tables.
You can also generate database tables from descriptors in your project.
Use this procedure to automatically generate SQL scripts to create the tables in a project.
You can also choose Selected > Generate Creation Script for > Selected Table or All Tables from the menu.
The OracleAS TopLink Mapping Workbench can automatically generate Java class definitions, descriptor definitions, and associated mappings from the information in database tables. You can later edit the generated information if necessary.
For each table, the OracleAS TopLink Mapping Workbench:
You can also choose Selected > Generate Descriptors and Classes from > Selected Table or All Tables from the menu.
Field | Description |
---|---|
Package Name |
Name of package to generate |
Generate Accessing Methods |
Specify if the OracleAS TopLink Mapping Workbench generates accessing methods for each class and descriptor |
You can also specify whether the relationships are bidirectional.
The newly created descriptors appear in the Navigator pane of the OracleAS TopLink Mapping Workbench.
Use this procedure to automatically generate EJB classes and descriptors for each database table. Generating EJB entities allows you to create:
<javax.ejb.EntityBean>
interface and four EJB 1.1 classes for each table
You can also choose Selected > Generate EJB Entities and Descriptors from > Selected Table or All Tables from the menu.
You can also specify whether the relationships are bidirectional.
The system creates the remote primary key, home, and bean classes for each bean and adds this information to the project.
Use this procedure to create a table in the database, based on the information in the OracleAS TopLink Mapping Workbench.
You can also create tables by selecting Selected > Create on Database > Selected Table or All Tables from the menu.
Note: You must log into the database before creating tables. See "Logging into the Database" for more information. |
The OracleAS TopLink Mapping Workbench creates the tables on the database.
The newly created descriptor(s) appear in the Navigator pane of the OracleAS TopLink Mapping Workbench. Use the EJB Info tab (see Figure 4-16) to modify the EJB information.
|
![]() Copyright © 1997, 2003 Oracle Corporation. All Rights Reserved. |
|