Skip to Main Content
Enterprise JavaBeans 3.1, 6th Edition
book

Enterprise JavaBeans 3.1, 6th Edition

by Andrew Lee Rubinger, Bill Burke
September 2010
Intermediate to advanced content levelIntermediate to advanced
766 pages
18h 35m
English
O'Reilly Media, Inc.
Content preview from Enterprise JavaBeans 3.1, 6th Edition

Chapter 5. The Stateless Session Bean

The stateless session bean is designed for efficiency and simplicity. Central to its design is the absence of conversational state, which is a topic worth exploring a bit further before delving into SLSB mechanics.

When we say conversational state, we refer to information exchanged and remembered within the context of a series of requests between the Client (caller) and EJB (service). We can illustrate this simply:

Mike: Hi, my name is Mike.
Service: Hello, Mike.
Mike: Do you know my name?
Service: Yes, your name is Mike.

Here, the state variable holding the name of the client is stored for the duration of the conversation. Stateless session beans are incapable of handling this exchange correctly; each invocation upon a SLSB proxy operates independently from those both before and after (see Figure 5-1). In fact, its underlying bean instances may be swapped interchangeably between requests.

Stateless session beans are EJB’s answer to traditional transaction-processing applications, which are executed using a procedure call. The procedure runs from beginning to end, finally returning the result. Once the invocation completes, nothing about the data that was manipulated or the details of the request is available. When finished servicing a method invocation, an SLSB instance may be reused as the target for a new request. In short, stateless session beans are engineered to be lightweight and fast at the expense of conversational state. A much better ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Reinventing the Organization for GenAI and LLMs

Reinventing the Organization for GenAI and LLMs

Ethan Mollick
JavaServer Faces

JavaServer Faces

Hans Bergsten
EJB 3 Developer Guide

EJB 3 Developer Guide

Michael Sikora

Publisher Resources

ISBN: 9781449399139Errata Page