background image

Enterprise Beans

<< Part 4. Enterprise Beans | When to Use Enterprise Beans >>
<< Part 4. Enterprise Beans | When to Use Enterprise Beans >>

Enterprise Beans

Enterprise Beans
Enterprise beans are Java EE components that implement Enterprise JavaBeans (EJB)
technology. Enterprise beans run in the EJB container, a runtime environment within the
Application Server (see
"Container Types" on page 49
). Although transparent to the application
developer, the EJB container provides system-level services such as transactions and security to
its enterprise beans. These services enable you to quickly build and deploy enterprise beans,
which form the core of transactional Java EE applications.
What Is an Enterprise Bean?
Written in the Java programming language, an enterprise bean is a server-side component that
encapsulates the business logic of an application. The business logic is the code that fulfills the
purpose of the application. In an inventory control application, for example, the enterprise
beans might implement the business logic in methods called checkInventoryLevel and
orderProduct
. By invoking these methods, clients can access the inventory services provided
by the application.
Benefits of Enterprise Beans
For several reasons, enterprise beans simplify the development of large, distributed
applications. First, because the EJB container provides system-level services to enterprise beans,
the bean developer can concentrate on solving business problems. The EJB container, rather
than the bean developer, is responsible for system-level services such as transaction
management and security authorization.
Second, because the beans rather than the clients contain the application's business logic, the
client developer can focus on the presentation of the client. The client developer does not have
to code the routines that implement business rules or access databases. As a result, the clients
are thinner, a benefit that is particularly important for clients that run on small devices.
20
C H A P T E R
2 0
631