We have to look at the transitions

Now that you’ve seen the overall state diagram, we have to drill down and find out what really happens (and why) when a stateful session bean transitions from one state to another.

Moving from does not exist to method ready

image with no caption

Moving from method ready to passivated and vice-versa

image with no caption

Moving from passivated or method ready to does not exist

image with no caption

Note

You have to know this lifecycle!

If you take the exam, you’ll thank us for beating it to death because you really must know it backwards and forward.

But even as a bean developer, this is so fundamental to writing your bean code that you DO want to have this memorized. This isn’t like one of those API memorization questions where you think, “Isn’t that what the docs are for?”

Even if you have an IDE that puts the container callbacks into your code for you, you still have to know what they mean and what you should or should not do in each one.

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.