This task is the first of four in a demonstration on how to create
a multi-page SDO application. In this task you create a master page, a detail
page, and configure and SDO for multiple use.
- Create a dynamic Web project with servlet version 2.4 and a WebSphere® Application
Server v6.1 target server.
- Create two Faces JSPs, for example updateDepartment.jsp (as
the master page) and createEmployee.jsp.
- With the page you want to use as the master page open, for example, updateDepartment.jsp,
in Page Data view, right-click and select . The Add Relational
Record wizard opens.
- Enter a name, for example department.
- Select the Fill record with existing data from the database button,
then click Next.
- Create or select a connection to your database. If you have the DB2® V8.2 SAMPLE
database installed, you can connect to it and follow along with the examples
for the rest of the steps.
- On the Record Properties page, select a table, for example, select DEPARTMENT,
then click Next.
- On the Column Selection and Other Tasks page, if the table does not have
a primary key, click Modify primary key.
- On the "Edit primary keys" page, select a primary key, for example, DEPTNO:String,
then click Close. You return to the On the Column Selection
and Other Tasks page.
- From the Advanced tasks, click Add another database table through
a relationship. The Create Relationship wizard opens.
- Select the Create a new relationship button.
- Select the table you want to create a relationship with, for example,
the EMPLOYEE Table, then click Next.
- On the Edit Your Relationship page, select 1->*PRIMARY KEY
-> FOREIGN KEY as the multiplicity.
- Click Modify <TABLENAME> primary key,
for example, Modify EMPLOYEE primary key. The Edit primary keys window opens.
- Select a primary key, for example, EMPNO:String, then click Close.
- Click on the Choose a column text in the foreign
key column and select a column in the drop-down list to use as the foreign
key, for example, EMPNO: String.
- Click Finish. Verify that you have a Relation node
and the correct primary keys, for example:
- From the Relation table, select only the columns you want to be able to
update, for example, in the EMPLOYEE table select EMPNO, FIRSTNME, MIDINIT,
LASTNAME.
- Click Finish.