Java Reference
In-Depth Information
What Are Enterprise JavaBeans?
Sun's Enterprise JavaBean specification defines the EJB architecture as follows: “The
Enterprise JavaBeans architecture is a component-based architecture for the development and
deployment of component-based distributed business applications. Applications written using
the Enterprise JavaBeans architecture are scalable, transactional, and multi-user secure. These
applications may be written once, and then deployed on any server platform that supports the
Enterprise JavaBeans specification.”
The definition mentions component-based-distributed business applications. The EJB architec-
ture enables different components of a system to exist on distributed machines and to operate
together as if they all existed in the same application space. Alone this might not sound much
different from Java's Remote Method Invocation (RMI), and actually EJB makes use of RMI
as part of its underlying structure. However, it is not this one aspect of EJB that makes the
architecture so powerful but it is this in combination with the other traits that are mentioned.
EJB systems are easily scalable. You will see how simple it is to add and remove functionality
to a system that has been written using the EJB architecture. Not only are the applications scal-
able in terms of functionality, but they can easily scale to handle changing numbers of clients
accessing the application. Because an application server manages EJBs, their number can be
increased or reduced depending on the need. This is a topic that will be discussed later.
Previously the application developer was responsible for writing and maintaining transactional
management code. The EJB designer has the ability to decide whether to let the EJBs manage
all transactions and how each individual EJB will participate in the transactions. It is important
to have all related tasks included within one transaction to make sure that all necessary tasks
are completed or that none of them are. This is the concept of ACID (Atomicity, Consistency,
Isolation, and Durability) transactions that are so talked about by database designers.
Another topic that we will discuss is the ability to reuse EJBs across many systems with very
little work. The two types of EJBs are the session bean and the entity bean. One holds the key
issues related to business logic, and the other acts as an object-oriented interface to your persis-
tence layer. Both can be easily moved from system to system, database to database, and from
platform to platform without the slightest code change. This is a great characteristic of any
software component, but when combined with the rest of the EJB concepts, it becomes a great
building block for all software systems.
The rest of this chapter will help you understand the power associated with designing a system
using EJBs. This is a brief chapter on a very complex topic. The specification itself is over 500
pages, and although it lays out exactly what all of the pieces of an EJB system are responsible
for, it does not discuss all of the intricacies of properly developing an EJB system. This chapter
attempts to give you an awareness of the topic, the ability to write and deploy simple
Enterprise JavaBeans, and the foundation to continue your education on the topic.
Search WWH ::

Custom Search