< Zurück | Inhalt | Weiter >

21.2.2 Bean Types

Enterprise JavaBeans come in more than one variety. Let’s take a look at those. Session Beans

A session bean is a reusable component that represents a collection of server methods. The intention is that each such method represents some business process, such as addCustomer(), createShoppingCart(), and so on.

Session beans are thus organized around business processes. Actually, a session bean is not much more than a facade that collects a business process API into a single class. But remember what EJBs give you—networked server- based functionality, load balancing, clustering features, reliability, failover, and the ability to handle increased demand by merely adding more Bean instances and server hardware. The power comes not from how EJBs extend the language, but from how they automate and hide infrastructure.

Session beans come in two major varieties: stateless and stateful. Let’s take a look at what they offer and the differences between the two.