|Oracle8i Enterprise JavaBeans and CORBA Developer's Guide
There are four major components that you must create to develop a complete EJB:
The home interface is an interface to an object that the container itself implements: the home object. The home interface has
create() methods that specify how a bean is created. The home interface with the home object actually serves as a factory object for EJBs.
The remote interface specifies the methods that you implement in the bean. These methods perform the business logic of the bean. The bean must also implement additional service methods that are called by the EJB container at various times in the life cycle of a bean. See Basic Concepts for more information about these service methods.
The client application itself does not access the bean directly. Rather, the container generates a server-side object called the EJBObject that serves as a server-side proxy for the bean. The EJBObject receives the messages from the client, and thus the container can interpose its own processing before the messages are sent to the bean implementation.
Why is this level of indirection necessary? Remember that the container provides services transparently for the bean. For example, if the bean is deployed with a transaction attribute that declares that the bean must run in its own transaction context, the container can start up the transaction before the message is passed to the bean, and can do a commit or rollback, as required, before return messages or data is sent back to the client.
Figure 2-1 shows the interaction among these components.
The bean implementation contains the Java code that implements the remote interface and the required container methods.
The deployment descriptor is an object that specifies attributes of the bean. For example, the deployment descriptor declares the transactional properties of the bean. At deployment time, the EJB deployer together with the application developer can decide whether the container should manage transaction support, or have the client do it.