Stateless Session Bean



A stateless session beans lifetime is the lifetime of a single method within it. It can contain several methods, but they are completely independent of each other.
A stateless session bean cannot hold any data between calls from the client, it is designed to carry out independent operations very efficiently.
Stateless session beans may scale to large numbers of clients with minimal impact to overall server resources.

A stateless session bean contains of two parts.

- One or more interfaces, called business interfaces, that describe what methods the stateless session bean implements.
- A class that implements the business interface(s). This is the actual Enterprise Java Bean and it is recognized by it’s @Stateless annotation.

This is what a business interface may look like. Note that the @Local annotation is used which means that the Stateless Session Bean will be called within the same enterprise application.
Had we instead declared the @Remote annotation, the Stateless Session Bean could have been called from anywhere outside the current application (through RMI).

and the implementation class (the EJB):







Search for more Java info on this site here:
Custom Search


Any thoughts or questions?