In Java RMI, the clients of a remote object did not call methods on the
remote object directly.
Instead, they call methods on a stub, which passes the method call information over the network to the skeleton, which calls the method on the remote object. The EJB model extends this notion by introducing the idea of the EJB container as an additional element in the interaction. The container has two main functions:
- It intercepts all method calls made by the client and carries out various actions (concerned with security and transaction management, among other things) before delegating them to an instance of the implementation class itself. That is, the container provides proxies that isolate the EJB's implementation class from its clients.
- It provides general services to the EJB, such as database connection pooling.