Booking A Trip Reservation; Examining The Code For The Reservation Ejb - MACROMEDIA 38000382 - JRun - Mac Getting Started Manual

Getting started guide
Table of Contents

Advertisement

Booking a trip reservation

To book a trip reservation, you must validate a credit card and create an order for the trip.
The reservation EJB is a workflow session bean that coordinates the trip booking
transaction. The reservation EJB calls the credit card EJB and the order EJB:
The credit card EJB is a session bean that has a
The order EJB is an entity bean. Entity beans provide methods to add (
delete (
The reservation EJB is a stateless session bean that coordinates the process of booking a
trip reservation. First it invokes the credit card EJB to validate the user's credit card. Then
the reservation EJB invokes the order EJB to create a new order.
Examine the Java source code for the following predeployed EJBs.

Examining the code for the reservation EJB

You can review the Java source code for the reservation EJB located in the tutorial_root/
compass-ear/reservation/compass directory. Open and look at the code in the following
files:
ReservationRemote.java
in the EJB. This EJB has only one business method called
book a trip.
ReservationHomeRemote.java
that takes no arguments.
ReservationBean.java
ejb-jar.xml
runtime attributes of the reservation EJB, located in jrun_root/servers/tutorial/
compass-ear/reservation/META-INF. It defines the reservation EJB as a stateless
session bean.
The
instance of the credit card EJB and then invokes the credit card EJB
Then it obtains an instance of the order EJB and invokes the order EJB
to insert a new order into the database.
This procedure shows how to write an EJB that invokes other EJBs and also
demonstrates how a session bean is used to coordinate a transaction.
), update (
ejbRemove
Provides an implementation for the methods defined in the
interface;
ejbRemove
Provides an
ejbCreate
the home interface
Provides an implementation for each business method defined in the remote
interface
Look at the deployment descriptor, an XML file containing the
method coordinates the process of reserving a trip. First it obtains an
reserve
validate
), and retrieve (
ejbStore
The remote interface lists the business methods available
This EJB is instantiated using a
The EJB implementation class does the following:
,
,
ejbPassivate
ejbActivate
method corresponding to each
method.
ejbCreate
) a row in a database.
ejbLoad
that allows you to
reserve
method
create
SessionBean
method defined in
create
method.
validate
create
Booking a trip reservation
),
method
93

Advertisement

Table of Contents
loading

This manual is also suitable for:

Jrun 4

Table of Contents