background image

When to Use Enterprise Beans

<< Enterprise Beans | What Is a Session Bean >>
<< Enterprise Beans | What Is a Session Bean >>

When to Use Enterprise Beans

Third, because enterprise beans are portable components, the application assembler can build
new applications from existing beans. These applications can run on any compliant Java EE
server provided that they use the standard APIs.
When to Use Enterprise Beans
You should consider using enterprise beans if your application has any of the following
requirements:
The application must be scalable. To accommodate a growing number of users, you may
need to distribute an application's components across multiple machines. Not only can the
enterprise beans of an application run on different machines, but also their location will
remain transparent to the clients.
Transactions must ensure data integrity. Enterprise beans support transactions, the
mechanisms that manage the concurrent access of shared objects.
The application will have a variety of clients. With only a few lines of code, remote clients
can easily locate enterprise beans. These clients can be thin, various, and numerous.
Types of Enterprise Beans
Table 20­1
summarizes the two types of enterprise beans. The following sections discuss each
type in more detail.
TABLE 20­1
Enterprise Bean Types
Enterprise Bean Type
Purpose
Session
Performs a task for a client; optionally may implement a web service
Message-Driven
Acts as a listener for a particular messaging type, such as the Java
Message Service API
Note ­
Entity beans have been replaced by Java Persistence API entities. For information about
entities, see
Chapter 24, "Introduction to the Java Persistence API."
What Is an Enterprise Bean?
The Java EE 5 Tutorial · September 2007
632