Stateful Session Bean
Table 4.1. Operations allowed in the methods of a stateful session bean
Bean method | Bean method can perform the following operations | |
---|---|---|
Container-managed transaction demarcation | Bean-managed transaction demarcation | |
constructor | - | - |
setSessionContext | SessionContext methods: getEJBHome, getEJBLocalHome. JNDI access to java:comp/env | SessionContext methods: getEJBHome, getEJBLocalHome. JNDI access to java:comp/env |
ejbCreate ejbRemove ejbActivate ejbPassivate | SessionContext methods: getEJBHome, getEJBLocalHome, getCallerPrincipal, isCallerInRole, getEJBObject, getEJBLocalObject. JNDI access to java:comp/env Resource manager access Enterprise bean access | SessionContext methods: getEJBHome, getEJBLocalHome, getCallerPrincipal, isCallerInRole, getEJBObject, getEJBLocalObject, getUserTransaction. UserTransaction methods JNDI access to java:comp/env Resource manager access Enterprise bean access |
Business method from component interface | SessionContext methods: getEJBHome, getEJBLocalHome, getCallerPrincipal, getRollbackOnly, isCallerInRole, setRollbackOnly, getEJBObject, getEJBLocalObject. JNDI access to java:comp/env Resource manager access Enterprise bean access | SessionContext methods: getEJBHome, getEJBLocalHome, getCallerPrincipal, isCallerInRole, getEJBObject, getEJBLocalObject, getUserTransaction. UserTransaction methods JNDI access to java:comp/env Resource manager access Enterprise bean access |
afterBegin beforeCompletion | SessionContext methods: getEJBHome, getEJBLocalHome, getCallerPrincipal, getRollbackOnly, isCallerInRole, setRollbackOnly, getEJBObject, getEJBLocalObject. JNDI access to java:comp/env Resource manager access Enterprise bean access | N/A (a bean with bean-managed transaction (BMT) demarcation cannot implement the SessionSynchronization interface) |
afterCompletion | SessionContext methods: getEJBHome, getEJBLocalHome, getCallerPrincipal, isCallerInRole, getEJBObject, getEJBLocalObject. JNDI access to java:comp/env |
Stateless Session Bean
Table 4.2. Operations allowed in the methods of a stateless session bean
Bean method | Bean method can perform the following operations | |
---|---|---|
Container-managed transaction demarcation | Bean-managed transaction demarcation | |
constructor | - | - |
setSessionContext | SessionContext methods: getEJBHome, getEJBLocalHome. JNDI access to java:comp/env | SessionContext methods: getEJBHome, getEJBLocalHome. JNDI access to java:comp/env |
ejbCreate ejbRemove | SessionContext methods: getEJBHome, getEJBLocalHome, getEJBObject, getEJBLocalObject. JNDI access to java:comp/env | SessionContext methods: getEJBHome, getEJBLocalHome, getEJBObject, getEJBLocalObject, getUserTransaction. JNDI access to java:comp/env |
Business method from component interface | SessionContext methods: getEJBHome, getEJBLocalHome, getCallerPrincipal, getRollbackOnly, isCallerInRole, setRollbackOnly, getEJBObject, getEJBLocalObject. JNDI access to java:comp/env Resource manager access Enterprise bean access | SessionContext methods: getEJBHome, getEJBLocalHome, getCallerPrincipal, isCallerInRole, getEJBObject, getEJBLocalObject, getUserTransaction. UserTransaction methods JNDI access to java:comp/env Resource manager access Enterprise bean access |
![]() ![]() ![]() ![]() ![]() ![]() |
![]() |
![]() |