Is there a request-bound context for an EJB3 session - beans? My environment is Java-EE-5.
In this example
@Remote(SessionFacade.class) @Stateless
public class SessionFacadeBean implements SessionFacade {
@EJB
private Other bean;
public void myBusinessMethod() {
*myRequestScope*.put("demo", Integer.valueOf( 1 ));
bean.otherBusinessMethod();
sysout(*myRequestScope*.get("demo"));
}
}
@Local(Other.class) @Stateless
public class OtherBean implements Other {
public void otherBusinessMethod() {
*myRequestScope*.put("demo", Integer.valueOf( 2 ));
}
}
should always print "2" when calling SessionFacadeBean # myBusinessMethod () - regardless of concurrent calls.
I have no luxury using CDI. And it should also work regardless of transactional propagation (therefore, JCA is also not an option).
source
share