Java Reference
In-Depth Information
Chapter 3. Building business logic with session beans
This chapter covers
• Stateless session beans
• Stateful session beans
• Singleton beans
• Asynchronous beans
At the heart of any enterprise application is its business logic. In an ideal world, application
developers should mainly be concerned with implementing business logic, while concerns
like presentation, persistence, and integration should largely be window dressing. From this
perspective, session beans are the most important part of the EJB technology because their
purpose in life is to model high-level business processes.
If you think of a business system as a horse-drawn chariot carrying the Greco-Roman cham-
pion to battle, session beans are the driver. Session beans utilize data and system resources
(the chariot and horses) to implement the goals of the user (the champion) using business
logic (the skills and judgment of the driver). For this and other reasons, sessions beans, par-
ticularly stateless session beans, have been popular, even despite the problems of EJB 2. EJB
3 makes this vital bean type much easier to use and adds some important functionality.
In chapter 1 we briefly introduced session beans. In chapter 2 you saw simple examples of
these beans in action. In this chapter, we'll discuss session beans in much greater detail, fo-
cusing on their purpose, the different types of session beans, how to develop them, and some
of the advanced session bean features available to you, including asynchronous processing
and concurrency management with singleton beans.
We start this chapter by exploring some basic session bean concepts and then discuss some
fundamental characteristics of session beans. We then cover each type—stateful, stateless,
singleton, and the asynchronous processing support that can be used with each one of these
beans—in detail.
Search WWH ::




Custom Search