Types of Enterprise JavaBeans

Although the containers provide the actual interface to the client, most people think in terms of the actual JavaBean itself. As with the EJB containers, Enterprise JavaBeans themselves come in two flavors:

  • Session beans

  • Entity beans

Session Beans

As the name implies, session beans persist for only as long as the actual session. After the session terminates, the session bean terminates. Normally, a session bean is associated with only a single client. Session beans are used when the business model calls for situations when the EJB does not have to survive beyond the session for other applications to user. A session bean can be either one of the following:

  • Stateful

  • Stateless

Sometimes a session bean needs to continuously ...

Get Object-Oriented Thought Process, The, Second Edition 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.