background image

The Contents of an Enterprise Bean

<< Web Service Client | Naming Conventions for Enterprise Beans >>
<< Web Service Client | Naming Conventions for Enterprise Beans >>

The Contents of an Enterprise Bean

As with remote clients, web service clients operate on different copies of parameters than does
the bean that implements the web service.
Granularity of Accessed Data
Because remote calls are likely to be slower than local calls, the parameters in remote methods
should be relatively coarse-grained. A coarse-grained object contains more data than a
fine-grained one, so fewer access calls are required. For the same reason, the parameters of the
methods called by web service clients should also be coarse-grained.
The Contents of an Enterprise Bean
To develop an enterprise bean, you must provide the following files:
Enterprise bean class
: Implements the methods defined in the business interface and any
life cycle callback methods.
Business Interfaces
: The business interface defines the methods implemented by the
enterprise bean class.
Helper classes
: Other classes needed by the enterprise bean class, such as exception and
utility classes.
You package the files in the preceding list into an EJB JAR file, the module that stores the
enterprise bean. An EJB JAR file is portable and can be used for different applications. To
assemble a Java EE application, you package one or more modules (such as EJB JAR files) into
an EAR file, the archive file that holds the application. When you deploy the EAR file that
contains the bean's EJB JAR file, you also deploy the enterprise bean to the Application Server.
You can also deploy an EJB JAR that is not contained in an EAR file.
Figure 20­2
shows the
contents of an EJB JAR file.
The Contents of an Enterprise Bean
The Java EE 5 Tutorial · September 2007
640