Architectural overview: Creating a Stateless Session bean

After getting a Home stub, the client calls “create” on the Home. The Home gives the client a stub to an existing EJBObject but does not associate a bean with this EJBObject! Instead, the bean stays in a pool until the client uses the EJBObject stub to call a business method.

image with no caption
  1. The client calls create() on the Home stub (create() is a method in the Home interface).

  2. The stub sends the create() call to the Remote Home object.

  3. The Home/container steps in and adds its services.

  4. An EJBObject is created for this client.

  5. The bean stays in the bean pool! It comes out only to service an actual business method, if the client invokes one on the EJBObject stub.

  6. The EJBObject stub is returned to the client, so the client can call business methods on the Component interface.

image with no caption

Get Head First EJB now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.