Set up a project in application Developer
Step 1. Creating data models and persistent storage
The data model for Dual applications is the same as in the "Hello World" Java application. First enter DB2, then create a database named Dualdb, and then create a table person in the database:
CREATE TABLE PERSON
(
ID
INTEGER NOT NULL PRIMARY KEY,
FIRSTNAME VARCHAR(40),
LASTNAME
VARCHAR(40)
)
This script is provided in the TABLE.DDL of the downloaded ZIP file.
Step 2. Create a project
In this step, we will create a set of projects in which each of the projects will be used for different purposes. For example, we will place entity beans and session beans in different jars because larger Java EE applications are often made up of several jars or projects. Please create the following items one after another:
A.java Project: DualJavaModule00. In this project, create the package dual.value. We will put the class person of VO into it.
B.J2EE 1.3 Project: Dualearforallinone. This project will be a placeholder for the all-in-one topology.
C.J2EE 1.3 Project: Dualearforejbcontainer. This project is intended to be used only as an EJB container.
4.J2EE 1.3 Project: Dualearforweb. This item is intended to be used only as a Servlet container. In addition, we can use Dualearforallinone to achieve the same goal, because the only difference between them is Project dependencies. However, it is best to keep them separate.
5.EJB 2.0 Item: DUALEJBMODULE01. associated with Dualearforejbcontainer. Create the package DUAL.EJB (in the Ejbmodule folder).
6.EJB 2.0 Item: DUALEJBMODULE02. associated with Dualearforejbcontainer. Similarly, create a package dual.ejb. Make this project dependent on DUALEJBMODULE01. (Dependencies will be further introduced later.) )
7.Web Project: DualWebModule03. When you create this project, select the Advanced options check box to relate it to dualearforweb. Create a package Dual.servlet within this WEB project. Do not select all the webproject features because this exercise does not require them.
After the initial project structure has been completed, the Java EE view in the Workbench should look like Figure 3.
Figure 3. A workbench with a project
In the project Navigator view, you can see all the items you have created.