O'Reilly logo

Enterprise JavaBeans, Second Edition by Richard Monson-Haefel

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 Beans

The beans contained in a JAR file are described within the deployment descriptor’s enterprise-beans element. So far, we’ve only talked about deployment descriptors for a single bean, but there’s no reason that you can’t package several 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 beans in the same JAR file. The deployment descriptor would look something like this:

<?xml version="1.0"?>
<!DOCTYPE ejb-jar PUBLIC "-//Sun Microsystems, Inc.//DTD Enterprise
JavaBeans 1.1//EN" "http://java.sun.com/j2ee/dtds/ejb-jar_1_1.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>TravelAgentBean</ejb-name>
      <remote>com.titan.travelagent.TravelAgent</remote>
      ...
   </session>
   <entity>
      <ejb-name>CustomerBean</ejb-name>
      <remote>com.titan.customer.Customer</remote>      
      ...
   </entity>
   <session>
      <ejb-name>ProcessPaymentBean</ejb-name>
      <remote>com.titan.processpayment.ProcessPayment</remote>
      ...
   </session>
   ...
 </enterprise-beans>
 <assembly-descriptor>
 ...
 </assembly-descriptor>
 ...
</ejb-jar>

In this descriptor, the enterprise-beans element contains two session elements and one entity element describing the three beans. Other elements within the entity and session elements provide detailed ...

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