Given a Stateless Session Bean with a Local Business Interface and CMT (Container Managed Transaction). All methods of the SLSB have Transaction Attribute set to "REQUIRED".
The Bean also has an injected field sessionContext of type SessionContext.
The question is: "Which two operations are allowed in a bean business method?"
According to EJB 3.0 Core Specification, Chapter 4 Table 2:
SessionContext methods: getBusinessObject,getEJBHome, getEJBLocalHome, getCallerPrincipal, isCallerInRole, getRollbackOnly, setRollbackOnly, getEJBObject, getEJBLocalObject, getTimerService,getInvokedBusinessInterface, lookup JNDI access to java:comp/env
Since this is a question of a simulator for SCBCD (1z0-860) Certification for Java EE 5, the provided answer is:
Other two possible options were "sessionContext.getEJBObject" and "sessionContext.getEJBLocalObject".
Having the SLSB a Business Local Interface, my second choice, after setRollbackOnly was to call getEJBLocalObject which actually is not the right answer.
Is the asnwer provided by simulator correct? If yes: Anyone can help me to better understand this scenario?
Regards, Pierluigi
Of the given options: