7.7. EJB

EJB (Enterprise JavaBeans) is a standard architecture of an environment for hosting server tiers of enterprise component applications. The EJB standard has evolved through several major revisions, which, besides introducing particular features, have also included changing the programming model between the 2.x and 3.x revisions due to the introduction of language annotations. The text in this section therefore deals separately with the 2.x and 3.x versions where necessary.

An EJB application consists of components called enterprise beans that reside in a container. The beans implement the business logic of the application, the container provides the beans with standard services including lifecycle, persistency, transactions, and makes the beans accessible to the clients.

Beans come in four distinct classes, namely stateful session beans, stateless session beans, message driven beans and entities. Each class is tailored to fill a specific role in a component application. For maximum simplicity, method invocations on all types of beans are serialized.