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" "http://java.sun.com/dtd/ejb-jar_2_0.dtd"> <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 the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.