Home > Articles > Programming > Java

Developing a Stateless Session Bean

  • Print
  • + Share This
This third article in a continuing column on Java enterprise technologies discusses the creation and deployment of a stateless session bean.
From the author of

My last article looked at entity beans, which represent data in a database. In this article, we turn our attention to session beans, which perform actions on data.


Session beans come in two flavors: stateless and stateful. Stateless session beans don't maintain any state between method calls, and stateful session beans do. This difference is straightforward to the developer but it has a major implication for the EJB container: If a bean doesn't maintain any state information, the client doesn't need to use the same bean on subsequent method calls. This translates to the EJB container's ability to manage pools of stateless session beans and distribute them as it sees fit. Stateless session beans are particularly useful for atomic operations that span multiple tables in a database and require a single transaction. This article focuses on stateless session beans; we'll pick up stateful session beans in a later article.

  • + Share This
  • 🔖 Save To Your Account