Sams Teach Yourself BEA WebLogic Server 7.0 in 21 Days
The final building block of the Airline Ticket Booking System MVC application is the data logic part of the Model layer. As was discussed before, the data logic part of the Model layer will be built using entity beans. The session beans in the business logic part of the Model layer will access and use the entity beans to interact with the database (in our case, PointBase). For accessing the data stored in the database tables, you will need to define three entity beans. These are defined based on the nature of data encapsulated by these entity beans. The data that the entity beans represent can be classified as flight information, passenger information, and ticket information. This data will be used by the session beans in the business logic part of the Model layer to send to the JSPs in the View layer. So, for these three sets of information, you can define three entity beans FlightBean, PassengerBean, and TicketInfoBean. To cut down development time, the entity beans will use CMP. Also, to improve performance, the entity beans will be colocated with the session beans and hence will use local instead of remote interfaces. Now take a look at the tables to which these entity beans will map:
There is one more layer of isolation that will be built in the MVC application. Because you do not want the entity beans to be passed across layers, you will be extracting the data within the entity beans and wrapping it inside business objects that mirror the entity beans but are just plain Java classes. The session beans will extract the data from the entity beans and populate the respective business objects. The business objects containing the data will then be passed on to the JSPs in the View layer embedded within the MVCAppValueObject. The JSPs will then extract the data from the business objects and format them as required. The three business objects that will be written are FlightDetails, PassengerProfile, and TicketDetails, organized in the com.sams.learnweblogic7.businessobject package. In order to understand the interaction of the entity beans that form part of the Model layer with the rest of the MVC application, take a look at Figure 13.5, which lists the sequence diagram of the Airline Ticket Booking System MVC application. Figure 13.5a. Sequence diagram of the Airline Ticket Booking System MVC application showing the Model (entity bean) layer interactions.The entire code of the FlightBean, PassengerBean, and TicketInfoBean entity beans is listed in Appendix C. This includes the listing for the home and local interfaces of these beans. |