Java Reference
In-Depth Information
EJB application server
EJB container
Client
User
EJB interface
EJB interface
EJB
implementation
EJB stub
Figure 8.1 EJBs use client-side stubs to communicate with server-side objects. Users of the
client-side EJBs use the remote interface, which in turn uses the proxy, which then uses the
distributed interface and the local implementation. The server supports a container, which
provides critical features to EJB components.
server. An object's interface is separated from the implementation. The inter-
face is deployed on both the client and the server. On the client side, a simple
stub is used, which communicates with the server-side distributed interface, as
shown in figure 8.1. Users can then use the client-side interface, which com-
municates with the stub and, by proxy, the remote interface, and eventually
the remote implementation.
8.1.2
Types of EJBs
There are two major types of EJB s in common use (with more on the way):
Session beans provide distributed transactional support, and entity beans pro-
vide a mechanism for building shared, transactional, persistent models:
Shared means that many different implementations can use the same
model, conserving resources and improving complex distributed
communications.
Transactional means that the database can support complex, multipart
transactions. We've heard the same idea with the database term unit of
work .
Persistent means the data is stored in a database. Though the structure of
the model is object-oriented, rich relational database support is provided.
Figure 8.2 shows the different subtypes of EJB s. Only the dark gray ones may
be used; the other nodes simply help us organize and categorize the types of
support. The two types of session beans are stateless and stateful . Stateless
Search WWH ::




Custom Search