Session beans are created and removed. If you’re lucky, you’re a stateless bean. Because the life of a stateful bean is tied to the whims of a heartless client. Stateful beans are created at the client’s insistence, and exist only to serve that one client. As a stateful bean, the best you can hope for is that the client crashes or forgets to call remove(); it might take the Container a while to figure out you’ve become useless. But ahhhh, the life of a stateless bean is fabulous! Pools, those little umbrella drinks, and no boredom since you get to meet so many different clients. Of course, even a stateless bean dies with an unchecked exception...
Get Head First EJB 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.