|[ Team LiB ]|
Case Study: XYZ Airlines Online Reservation System
To streamline the discussion on Session Beans, let's work with a simple case study. We're building an online reservation system for XYZ Airlines. The functionality requires us to build a system using which a user can search for flights. Following that, the user reserves one or more seats on a flight that she chooses. We'll code an AirlineReservation Stateless Session Bean with two methods in it. To keep this case study simple, let's assume that reserving a seat on a flight translates to reducing the number of available seats in the flight by one.
The company wants to provide a shopping cart–type of interface to the user. The user should be able to buy tickets on as many flights as required and pay for all of them at once in the final step. We'll code an AirlineShoppingCart Stateful Session Bean to accomplish this. We won't develop the payment system. All our shopping cart must do is provide the total amount when requested.
Let's work out the database schema that we'll use. To keep it simple, our schema involves only one table: FlightRecord. Table 21.1 illustrates the structure of the FlightRecord table.
We'll be using PointBase as our database server. The SQL required to create this schema in your PointBase database is provided in the file called schema.sql, which is packaged along with this book. Use this SQL file to create the schema in your PointBase database. This file also loads the table with some dummy data for the purpose of our case study. Perform the following tasks prior to proceeding with the rest of this chapter.
Start the PointBase database server and execute the schema.sql in the PointBase console, so that the schema is created and the records are populated. When this has been done, start WebLogic Server (leave the database server running). Now create a new JDBC connection pool called XYZAirlineConnectionPool using the WebLogic console. Following that, create a new DataSource object called XYZAirlineDataSource, which uses the previously created connection pool.
For more information about any of these tasks and a detailed explanation of how you can perform them, refer to Chapter 10, "Managing Database Connectivity Using JDBC."
|[ Team LiB ]|