I have 2 questions regarding what is allowed/disallowed for a Stateful/Stateless bean. It would be great if someone could answer them.
1. setRollbackOnly() and getRollbackOnly() of the SessionContext.
2. Accessing other enterprise beans and resource Managers.
The EJB spec says (1) and (2) cannot happen if the container does not have a meaningful transaction context. But, I could see that the ejbCreate, ejbRemove, ejbActivate, ejbPassivate methods for stateful session bean allows (2) but disallows (1). How is (2) allowed if the container is in unspecified transaction context ?
b. The EJB spec says the stateless session bean can get a reference to EJBObject in its ejbCreate() method. My question is :
For a stateless session beans, Only when client calls create() on the Home, will the EJBObject be created ( atleast that what we should visualize) and the bean creation is not tied to client's create() call ( i.e the bean could have been in the pool long before the client's create() call.) If this is the case, there wont be any EJBObject during ejbCreate. So How can SessionContext.getEJBObject() possible during ejbCreate Call ? Let me know if I am right on my assumptions.