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 6. The Stateful Session Bean

While the strengths of the stateless session bean lie in its speed and efficiency, stateful session beans are built as a server-side extension of the client. Each SFSB is dedicated to one client for the life of the bean instance; it acts on behalf of that client as its agent (see Figure 6-1). Stateful session beans are not swapped among EJB objects, nor are they kept in an instance pool like their stateless session counterparts. Once a stateful session bean is instantiated and assigned to an EJB object, it is dedicated to that EJB object for its entire lifecycle.[10]

Client relationship with the EJB Container and backing bean instances

Figure 6-1. Client relationship with the EJB Container and backing bean instances

Stateful session beans maintain conversational state, which means that the instance variables of the bean class can maintain data specific to the client between method invocations. This makes it possible for methods to be interdependent such that changes made to the bean’s state in one method call can affect the results of subsequent method invocations. Therefore, every method call from a client must be serviced by the same instance (at least conceptually), so the bean instance’s state can be predicted from one method invocation to the next. In contrast, stateless session beans don’t maintain client-specific data from one method call to the next, so any instance can be used to service any method call from ...

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