Home Javacertification Bcd-guide Given a list of methods for a stateful or stateless session bean class, define which of the following operations can be performed from each of those methods: SessionContext interface metho

Ask Questions?

View Latest Questions

Advertisement


 
 

Given a list of methods for a stateful or stateless session bean class, define which of the following operations can be performed from each of those methods: SessionContext interface metho
Posted on: April 18, 2011 at 12:00 AM
This page discusses - Given a list of methods for a stateful or stateless session bean class, define which of the following operations can be performed from each of those methods: SessionContext interface metho

Given a list of methods for a stateful or stateless session bean class, define which of the following operations can be performed from each of those methods: SessionContext interface methods, UserTransaction methods, Java Naming and Directory Interface API (JNDI API) access to java:comp/env environment naming context, resource manager access, and other enterprise bean access.

Stateful Session Bean

Table 4.1. Operations allowed in the methods of a stateful session bean

Bean methodBean method can perform the following operations
Container-managed transaction demarcationBean-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 methodBean method can perform the following operations
Container-managed transaction demarcationBean-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

Advertisement


DMCA.com