Chapter 8. Callbacks and Interceptors

In the previous chapter, you learned that session beans are container-managed components. They live in an EJB container, which wraps business code behind the scenes with several services (dependency injection, transaction management, security, and so on). Two of these services are life-cycle management and interception.

Life cycle means that a session bean goes through a predefined set of state transitions. Depending on the type of your bean (stateless, stateful, singleton), the life cycle will consist of different states. Each time the container changes the life-cycle state, it can invoke methods that are annotated with callback annotations. As an example, you can use these annotations to initialize any resources ...

Get Beginning Java™ EE 6 Platform with GlassFish™ 3 now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.