Creating a Stateless Session Bean

From a programming standpoint, it's just as easy to create a stateless session bean as it is to create a stateful one. The only real difference, other than changing a setting in the deployment tool, is in the initial design of the bean. A stateless session bean doesn't remember anything from one method invocation to the next, so any information the bean requires must be passed in from the client. Although it's true that a stateless session bean doesn't remember session-oriented data, you can store data in a stateless session bean. You just can't store client-specific data.

In the HelloWorldSession example bean, the bean had a greeting string that it remembered between method invocations. For instance, you called ...

Get Special Edition Using Java™ 2 Enterprise 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.