About Enterprise JavaBeans components

The Enterprise JavaBeans (EJB) technology defines a model for the development and deployment of reusable Java server components, called EJB components.

An EJB component is a nonvisual server component with methods that typically provide business logic in distributed applications. A remote client, called an EJB client, can invoke these methods, which typically results in the updating of a database. Since EAServer uses CORBA IIOP protocols, EJB components running in EAServer can be called by any other type of EAServer client or component, and even CORBA clients using ORBs from other vendors that are compatible with CORBA 2.3.

Figure 1-1 shows the components in the EJB architecture.

Figure 1-1: EJB Architecture

Application server The application server contains the EJB container and can contain other features such as a Web application container to host Web components such as JavaServer Pages (JSPs) and Java servlets. EAServer is an application server.

EJB container The EJB container runs EJB components and provides required services such as enforcing application security constraints, managing transactions that involve multiple components and databases, and providing the naming service that maps components and resources to logical names. The container provides the infrastructure required to run distributed components, allowing client and component developers to focus on programming business logic, and not system-level code.

EJB client An EJB client usually provides the user-interface logic on a client machine. The EJB client makes calls to remote EJB components on a server and needs to know how to find the EJB server and how to interact with the EJB components. EJB components and Web components can act as an EJB client by calling methods in another EJB component.

Session Beans and Entity Beans EJB components can be of two types. Most applications include session beans to be invoked directly by clients. Session beans provide the interface between base clients and the server-side implementation of the application. Entity beans provide an abstraction of an object that is stored in a database. Entity beans are not typically invoked directly by base clients. “EJB component types” describes the EJB component types in more detail.

All types of EJB are implemented by a Java class that contains implementations of the remote interface methods and additional methods for lifecycle management.

Client interfaces An EJB client does not communicate directly with an EJB component. The container provides proxy objects that implement the components home and remote interfaces. The component’s remote interface defines the business methods that can be called by the client. The client calls the home interface methods to create and destroy proxies for the remote interface. Clients use the Java name service to resolve components; the name service maps the component’s logical name to a proxy objects that implement the home and remote interfaces. The proxies contain generated code required to invoke the component over the network.

Beginning in EJB version 2.0, EJB and Web components running in the same server can execute EJB components using the component’s local interface. Using the local interface can improve performance. If an EJB component is not meant to be invoked directly by client applications, you can include only local interfaces for the component.