O'Reilly logo

Enterprise JavaBeans, Fourth Edition by Richard Monson-Haefel, Bill Burke, Sacha Labourey

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Describing Enterprise Beans

The enterprise beans contained in a JAR file are laid out within the deployment descriptor’s <enterprise-beans> element. So far, we have talked about deployment descriptors for 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, Reservation, and ReservationProcessor EJBs in the same JAR file. The deployment descriptor would look something like this:

<?xml version="1.0" encoding="UTF-8"?>
...
<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>
    <relationships>
        ...
    </relationships>
    <assembly-descriptor>
        ...
    </assembly-descriptor>
    ...
</ejb-jar>

In this descriptor, the <enterprise-beans> element contains two <session> elements, one <entity> element, and a <message-driven> ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required