This appendix contains state and sequence diagrams for all the bean types discussed in this book: container-managed and bean-managed entity beans, stateless and stateful session beans, and message-driven beans. Although standard Unified Modeling Language (UML) is used in these diagrams, some extensions were required to model EJB runtime characteristics. In the state diagrams, for example, callback methods and class instantiation operations are shown as part of the transition event.
In the sequence diagrams, container-provided classes such as the container itself, the EJB object, and the EJB home are shown as separate classes but are also boxed together. Messages sent from classes in the container system box are considered to be sent from the container system as a whole, not necessarily from the specific container-provided class. This generalization is necessary because the container’s interaction with the bean is characterized by these classes but differs from one vendor’s implementation to the next. The exact source of the message is immaterial, as long as you realize that the container system sent it.
Table B-1 summarizes the operations an entity bean
is allowed to perform in various stages of its life cycle. The
allowed operations are the same for EJB 2.0 and 1.1, except for the
EntityContext
methods
getEJBLocalHome()
and
getEJBLocalObject()
and the operations allowed for
ejbHome()
methods, which are specific to EJB 2.0.
Table B-1. Allowed operations for entity beans
Method |
Allowed operations |
---|---|
|
JNDI ENC contexts: Properties: |
|
JNDI ENC contexts: Properties: Resource managers: EJB references: |
Business methods |
JNDI ENC contexts: Properties: Resource managers: EJB references: |
|
JNDI ENC contexts: Properties: |
Note that entity beans can never access the
EJBContext.getUserTransaction()
method, because
entity beans are not allowed to manage their own transactions. Only
session beans can access this method.