Chapter 2. Session Beans

In this chapter, we will cover:

  • Creating a stateless session bean
  • Creating a stateful session bean
  • Creating a singleton bean
  • Using multiple singleton beans
  • Using container managed concurrency
  • Using bean managed concurrency
  • Controlling the initialization process
  • Using session beans with more than one business interface
  • Understanding parameter behavior and granularity
  • Using an asynchronous method to create a background process


The three basic session beans: stateless, stateful, and singleton, are at the heart of most EJB applications. They each differ in their purpose and capabilities. This chapter provides numerous examples of how they can be used and provides insight into how they work.

Many of the examples in this chapter ...

Get EJB 3.1 Cookbook now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.