Sun Logo


Sun ONE Studio 5 J2EE Application Tutorial

817-2322-10



Contents

Before You Begin

1. Getting Started

Obtaining and Installing the Required Software

Starting the Software

Starting the IDE

Starting the Application Server

Confirming Sun ONE Application Server 7 as the Default Server

Setting Up Database Connectivity

Enabling the JDBC Driver

Setting JDBC Resources (Microsoft Windows Superusers)

Setting JDBC Resources (All Other Users)

Tutorial Database Table Descriptions

2. Introduction to the Tutorial

Functionality of the Tutorial Application

Application Scenarios

Application Functional Specification

User's View of the Tutorial Application

Architecture of the Tutorial Application

Application Elements

EJB Tier Details

Overview of Tasks for Creating the Tutorial Application

Creating the EJB Components

Creating the Tutorial's Web Service

Installing and Using the Provided Client

End Comments

3. Building the EJB Tier of the DiningGuide Application

Overview of the Tutorial's EJB Tier

The Entity Beans

The Session Bean

The Detail Classes

Summary of Steps

Creating Entity Beans With the EJB Builder

Creating the Restaurant and Customerreview Entity Beans

Creating Create Methods for CMP Entity Beans

Creating Finder Methods on Entity Beans

Creating Business Methods for Testing Purposes

Creating Detail Classes to View Entity Bean Data

Creating the Detail Classes

Creating the Detail Class Properties and Their Accessor Methods

Creating the Detail Class Constructors

Creating Business Methods on the Entity Beans to Fetch the Detail Classes

Testing the Entity Beans

Creating a Test Client for the Restaurant Bean

Providing the Sun ONE Application Server 7 Plugin With Database Information

Deploying and Executing the Restaurant Bean's Test Application

Using the Test Client to Test the Restaurant Bean

Checking the Additions to the Database

Creating a Test Client for the Customerreview Bean

Deploying and Executing the Customerreview Bean's Test Application

Testing the Customerreview Entity Bean

Checking the Additions to the Database

Creating a Session Bean With the EJB Builder

Coding a Session Bean's Create Method

Creating Business Methods to Get the Detail Data

Creating a Business Method to Create a Customer Review Record

Creating Business Methods That Return Detail Class Types

Adding EJB References

Testing the Session Bean

Creating a Test Client for a Session Bean

Adding Entity Bean References to the EJB Module

Providing the Sun ONE Application Server 7 Plugin With Database Information

Deploying and Executing the Test Application

Using the Test Client to Test a Session Bean

Checking the Additions to the Database

Comments on Creating a Client

4. Creating the DiningGuide Application's Web Service

Overview of the Tutorial's Web Service

The Web Service

The Runtime Classes

The Client Files

Creating the Tutorial's Web Service

Creating the Logical Web Service

Generating the Web Service's Runtime Classes

Testing the Web Service

Creating a Test Client and Test Application

Adding the Web Service to the J2EE Application

Deploying the Test Application

Using the Test Application to Test the Web Service

Making Your Web Service Available to Other Developers

Generating the WSDL File

Generating Client Files From the WSDL File

5. Creating a Client for the Tutorial Application

Creating the Client With the Provided Code

Running the Tutorial Application

Examining the Client Code

Displaying Restaurant Data

Displaying Customer Review Data for a Selected Restaurant

Creating a New Customer Review Record

A. DiningGuide Source Files

RestaurantBean.java Source

RestaurantDetail.java Source

CustomerreviewBean.java Source

CustomerreviewDetail.java Source

DiningGuideManagerBean.java Source

RestaurantTable.java Source

CustomerReviewTable.java Source

B. DiningGuide Database Script

Script for a PointBase Database

Script for an Oracle Database

C. Creating the Tutorial with an Oracle Database

Setting up Database Connectivity with the Oracle Database

Enabling the Oracle Type 4 JDBC Driver

Connecting the IDE to the Oracle Server

Creating a JDBC Connection Pool

Creating a JDBC Data Source

Creating a JDBC Persistent Manager

Creating the Database Tables

Creating EJB Components with an Oracle Database

Creating the Web Service with an Oracle Database

Index