Search code examples
javaejb-3.0statelessstateless-session-bean

need help in EJB stateless beans


I am new to EJB. I have a requirement of calling a method of remote stateless bean and setting a value, before calling any method on the same bean. The value set from first method call should be available to second method. I know that a stateless bean can't hold instance variables values for next calls. Is there any alternative to make the value available to the bean method without making bean as stateful bean. any tweaking tip?


Solution

  • Is there any alternative to make the value available to the bean method without making bean as stateful bean?

    Without passing the value to the second method or persisting it, for example in database, I don't think so (using an instance variables is certainly not a solution as you're not sure to call the same session bean with each method call because the pool can return any session bean for your method call).