40 Chapter 2 THE EJB (Cheap web hosting) CONTAINER: YOUR SILENT

40 Chapter 2 THE EJB CONTAINER: YOUR SILENT PARTNER EJB containers are responsible for managing your beans. Containers can interact with your beans by calling your beans required management methods as necessary. These management methods are your beans callback methods that the container, and only the container, invokes. The management methods allow the container to alert your beans when middleware events take place, such as when an entity bean is about to be persisted to storage. The most important responsibility of an EJB container is to provide an environment in which enterprise beans can run. EJB containers house the enterprise beans and make them available for clients to invoke remotely. In essence, EJB containers act as invisible middlemen between the client and the beans. They are responsible for connecting clients to beans, performing transaction coordination, providing persistence, managing a bean s life cycle, and other tasks. The key to understanding EJB containers is to realize that they are abstract entities. Neither the beans nor the clients that call beans ever explicitly code to the API of an EJB container. Rather, the container implicitly manages the overhead of a distributed component architecture. The container is analogous to a behind-the-scenes stage manager in a theater, providing the lighting and backdrop necessary for a successful stage performance by the actors on stage. Neither the actors nor the audience interact directly with the stage manager. The same is true for EJB containers. Clients that call the beans never code directly to an EJB container API. javax.ejb.EJBObject lists a number of interesting methods. For now, don t worry about fully understanding the meanings just know that these are required methods that all EJB objects must implement. And remember that you don t implement the methods the EJB container does when it autogenerates the EJB objects for you. public interface javax.ejb.EJBObject extends java.rmi.Remote { public javax.ejb.EJBHome getEJBHome() throws java.rmi.RemoteException; public java.lang.Object getPrimaryKey() throws java.rmi.RemoteException; public void remove() throws java.rmi.RemoteException, javax.ejb.RemoveException; public javax.ejb.Handle getHandle() Source 2.2 A preview of the javax.ejb.EJBObject interface.
Try discount web hosting services, our team’s aim is to offer the best possible web hosting services, at the lowest possible price.

Leave a Reply