Enterprise JavaBean Under the Hood

Figure 2.2 shows the enterprise bean under the hood. The client looks up the EJB home object of the installed enterprise bean via Java Naming and Directory Interface (JNDI) services. The client then uses the home object to create an enterprise bean instance. However, the client isn't given a direct reference to the newly created enterprise bean instance. Instead the client receives reference to an EJB object, an object of the component interface. The client then calls the EJB object, which delegates calls to the enterprise bean instance.

Figure 2.2. Enterprise JavaBean under the hood.


Note

A client never directly creates or accesses instances of the Enterprise JavaBean instance. Only the container creates the Enterprise JavaBean instances, and registers its home interface into the JNDI service.


Because all method calls from a client to an Enterprise JavaBean are indirect (through the EJB home object or EJB object), the EJB container can control how and when calls to the Enterprise JavaBean class occur. This indirection allows the EJB container to provide functionality such as life cycle management, security, and transactions between Enterprise JavaBean class method calls.

Caution

The material discussed in this section is applicable only to session and entity beans. Clients access session beans and entity beans through interfaces. However, clients don't access message-driven beans through interfaces. A message-driven bean contains only a bean class and doesn't have interfaces that define client access. The main access to a message-driven bean is through the JMS provider using a JMS destination (queue or topic).


..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.12.166.255