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 ...
Get Enterprise JavaBeans, Second 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.