4.2.12 Precautions regarding the methods of the javax.ejb.EJBContext interface

Depending on the transaction management model of the Enterprise Bean, you might not issue the models for the getUserTransaction method, getRollbackOnly method, or the setRollbackOnly method of the javax.ejb.EJBContext interface. Furthermore, among the methods of the Enterprise Bean, the methods that are operated with the "Unspecified transaction" status according to the EJB specifications cannot be issued. If a method cannot be issued, the EJB container throws java.lang.IllegalStateException. The possibility of issuing each method is described in the following tables.

Table 4-2 Possibility of issuing each transaction management model

javax.ejb.EJBContext methodPossibility of issuing
BMTCMT
getUserTransactionY--
getRollbackOnly----
setRollbackOnly--Y
Legend:
Y: Can be issued
--: Cannot be issued

Table 4-3 Possibility of issuing each EJB method

Type of BeansMethodPossibility of issuing
SessionBeanConstructor--
setSessionContext--
ejbCreate--
ejbRemove--
ejbPassivate--
ejbActivate--
Business methodY
afterBeginY
beforeCompletionY
afterCompletion--
EntityBeanConstructorY
setEntityContext--
unsetEntityContext--
ejbCreateY
ejbPostCreateY
ejbRemoveY
ejbHomeY
ejbPassivate--
ejbActivate--
ejbLoadY
ejbStoreY
Business methodY
Message-driven BeanConstructor--
ejbCreate--
onMessageY
Methods of the message listenerY
ejbRemove--
Legend:
Y: Can be issued
--: Cannot be issued