javajakarta-eewebejbsession-bean

ejb interceptor for a stateless session bean,how can i invoke a stateful session bean


A class is a stateful session bean with a loginUser property. B class is a stateless session bean with a method addAUser. how does the interceptor check wether A.loginUser is null when B.addUser method be used. thank u .


Solution

  • This problem cant be solved by injecting statefull into stateless. Because this is a EJB anti-pattern. Have a look at CDI. It provides session-scoped beans like Spring. the only limitation is that its available only since JEE6.