Exploring the session bean lifecycle

Imagine you’re a session bean. What matters to you? What are the key moments in your life? What do you need to know about the client? What do you need to know about the Container? What do you need to get from the Container?

Now imagine you’re the client. What’s your motivation? What do you need to know about how the Container works? And what if you’re the Container? What do you have to do to manage a bean’s life, and when do you have to do it?

If you’re the Bean Provider, what do you have to know about the bean’s lifecycle in order to write code that works? What if you want that code to be efficient?

In this chapter, we look at the entire world of a session bean, and we do it from different points of view. We take an OO approach to this chapter, iterating through deeper levels of detail. So don’t panic if the first several pages feel a little too high-level, or leave you with questions. You’ll be down in the dirt before the chapter’s done.

Before we start, let’s introduce the players:

image with no caption
image with no caption

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.