How EJBs Work

Under the J2EE model, EJBs are distributed objects managed by containers. The real work is done by individual bean instances. The container provides surrogates (EJB objects) that interact with these instances, on behalf of the client. It's responsible for the creation and destruction of beans as necessary—in other words, for the lifecycle of its bean instances. The relationship between clients, the EJB container, and bean instances is shown in Figure 8-1.

Figure 8-1. Interaction of EJB clients, containers, and bean instances

As the figure shows, a client communicates with an EJBObject, provided by the EJB countainer. There are actually ...

Get Building Scalable and High-Performance Java™ Web Applications Using J2EE™ Technology now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.