6 Replies Latest reply on May 6, 2008 5:06 AM by Daniel Young

    Stateless Session Bean in Application context

    Michal Belicek Newbie

      Hi, I have a problem understanding the implications of having the Stateless Session Bean (SLB) in Application context. The current reference documentation says that SLBs always live in stateless context.

      So if I mark the SLB with @Scope(ScopeType.APPLICATION) (or any other scope in that matter) what happens? Is the scope annotation ignored or the SLB will be living the the specified context or in both contexts (stateless context and application context)?

      Found no detailed information in documentation how such SLB behaves. The docs say that the SLBs do not hold state across multiple invocations. So if I have SLB in app context does it mean that everytime I access it e.g. from conversation or session scope it would be created new or not? Or maybe because of the pooling sometimes I would get my stored values and sometimes not?

      How is SLB in app context different from SFB (stateful bean) in app context? I know that concurrent access to SFB is serialized. But any more info?

      Additionaly if I want a bean in app context for storing some nonchanging data - like a list of some categories for example what would be suggested? I've read in the forum that stateless pojo bean with @Startup annotation and @Create method for initialization of the data is suggested. But what if I want to use EJB not a pojo? The @Create annotation in SLB is not allowed and if I use @Init annotation then I can't use entity manager in it because I get exception.

      I'm just starting with Seam now and try to read all the relevant docs I can find so sorry if my questions might be off. Currently I'm using Seam 2.0.1.GA.