J2EE 1.3 Samples
An Oracle9i JDeveloper Sample
October 2002
Content
Introduction
This sample shows a J2EE Application build on top of HR Schema in Oracle database
Requirements
- Oracle9i JDeveloper 9.0.3 is used as the development and testing environment.
- Embedded OC4J is used for running J2EE Modules
- Oracle database.
Prerequistes
- HR Schema in Oracle database
Note: Check out the following instruction on installing
HR schema.
Launch Help System
Select Tutorials
Select Creating and Populating the Sample Schema Tables
- In JDeveloper create a database connection pointing to HR schema with the
name hr.
Running J2EE 1.3 Samples
- Extract workspace and place into JDeveloper mywork directory
- Extract j2ee13samples.zip into <jdev
home>/jdev/mywork directory
- Start JDeveloper
- From JDeveloper open the workspace J2EEApplication.jws
by choosing File | Open, navigate to <jdev
home>/jdev/mywork/j2ee13sample directory, and choose J2EEApplication.jws
- Click on J2EEApplication.jws '+' sign
in the System Navigator to expand the workspace
- Right-click on J2EEApplication.jws and choose
Make Workspace
Business Tier / EJB Module
Project BusinessTier.jpr contains a session bean
hrApp which acts as a facade for Entity Beans Departments
and Employees. hrApp
session bean has business methods exposed in local and remote interfaces. References
and Relationships between EJBs are visually shown in the EJB Modeler which is
profile of the UML Class Diagram.
Business method listDepartments() returns the list
of all Departments by calling the findAll() method
in the Departments Entity bean. Busines method listByDname()
returns the details of the department by calling the finder method findByDname()
which has an EJBQL. Business method listEmployees()
returns the list of all the employees by calling the CMR accessor method in
Departments Entity bean.
hrAppClient.java is a Java Class which calls the
business methods in session bean using the remote interface.
- Open BusinessTier.jpr project. (Click
on + sign)
- Open hr node
- Double-click on MYHRAPPLICATION to view the
UML Model
- Right-click on hrApp and choose Run.
(will start Embedded OC4J Server)
- Right-click on hrAppClient.java and choose Run.
Web Tier / Module
Project WebTier.jpr contains a JSP page showEmployees.jsp
which uses OJSP EJB tag library to call listEmployees()
business method in hrApp session bean. Web Application
Deployment Descriptor (web.xml) has an entry for EJB local reference to lookup
hrApp session bean which is used in useHome
tag.
JSP page shows the list of all employees in Department 80 in a table format.
- Open WebTier.jpr project (Click on + sign)
- Right-click on showEmployees.jsp file and choose
Run
Summary
This sample demonstrates how you can develop J2EE 1.3 modules using EJB Modeler,
EJB Module Editor and OJSP tags and run them with Embedded OC4J Server in Oracle9i
JDeveloper.
|