Describing Enterprise Beans

The enterprise beans contained in a JAR file are described within the deployment descriptor’s <enterprise-beans> element. So far we have talked about deployment descriptors for only a single enterprise bean, but it is possible to package several enterprise beans in a JAR file and describe them all within a single deployment descriptor. We could, for example, have deployed the TravelAgent, ProcessPayment, Cruise, Customer, and Reservation EJBs in the same JAR file.

In EJB 2.0, we could also add a message-driven bean, such as the ReservationProcessor EJB we developed in Chapter 13. The EJB 2.0 deployment descriptor would look something like this:

<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE ejb-jar PUBLIC "-//Sun Microsystems, Inc.//DTD Enterprise JavaBeans 2.0//EN" ""> <ejb-jar> <description> This Deployment includes all the beans needed to make a reservation: TravelAgent, ProcessPayment, Reservation, Customer, Cruise, and Cabin. </description> <enterprise-beans> <session> <ejb-name>TravelAgentEJB</ejb-name> <remote>com.titan.travelagent.TravelAgentRemote</remote> ... </session> <entity> <ejb-name>CustomerEJB</ejb-name> <remote>com.titan.customer.CustomerRemote</remote> ... </entity> <session> <ejb-name>ProcessPaymentEJB</ejb-name> <remote>com.titan.processpayment.ProcessPaymentRemote</remote> ... </session> <message-driven> <ejb-name>ReservationProcessorEJB</ejb-name> ... </message-driven> ... </enterprise-beans> ...

Get Enterprise JavaBeans, Third Edition now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.