Create a New Project |
![]() Previous |
![]() Next |
In this step, you will create a new Oracle JDeveloper project.
For more information, see "Creating a Project" in Oracle Toplink Developer's Guide.
Select File > New. The New Gallery appears.
In the Categories pane select General > Applications. In the Items pane select Application and click OK. The Create Application dialog appears.
Enter an Application Name (such as Tutorial), select No Template [All Technologies] as the Application Template, and click OK. The Create Project dialog appears.
Enter a Project Name (such as Advanced_Tutorial) and click OK.
JDeveloper adds the project to the Applications Navigator.
Now that you have an empty JDeveloper project, we will add a TopLink map to the project. This will contain the mapping information for the Java classes.
Right-click the Advanced_Tutorial project in the Applications Navigator and select New. The New Gallery appears.
In the Categories pane, select Business Tier > TopLink. In the Items pane select TopLink Object-Relational Map and click OK. The Create Object-Relational Map dialog appears.
Enter a TopLink Map Name (such as tlMap1), select the Database Platform (such as Oracle10g), the Database Connection (that you created previously) and click OK.
The Applications Navigator shows the new TopLink map.
Now you will add the necessary database tables as offline objects to the JDeveloper project.
For more information, see "Working with Databases" in Oracle Toplink Developer's Guide.
Right-click the Advanced_Tutorial project in the Applications Navigator and select New. The New Gallery appears.
In the Categories pane, select Database Tier > Offline Database Objects. In the Items pane select Offline Database Objects Imported from Database and click OK. The Import Offline Database Objects wizard appears.
Complete this wizard to import the following database tables from your database connection into the JDeveloper project. Use the same database connection that you created earlier (see "Create a Database Connection").
ADDRESS
EMPLOYEE
LPROJECT
PHONE
PROJ_EMP
PROJECT
RESPONS
SALARY
SEQUENCE
Sequencing allows TopLink to automatically assign the primary key or ID of an object when the object is inserted. Here, we will tell TopLink to obtain the sequence values from a specific database table.
For more information, see "Understanding Sequencing in Relational Projects" in Oracle Toplink Developer's Guide.
Right-click the tlMap1 TopLink map in the Applications Navigator and select Open. The TopLink Map properties page appears in the Mapping editor. Select the Database Info tab.
In the Sequencing area, select Custom Sequence Table. Use this table to complete the remaining fields.
| Field | Description |
|---|---|
| Name | SEQUENCE |
| Sequence Name Field | SEQ_NAME |
| Sequence Counter Field | SEQ_COUNT |