2 Replies Latest reply on Feb 25, 2007 5:29 PM by fernando_jmt

    ScopeType.STATELESS misunderstanding

    fernando_jmt

      Hi everyone.

      I'm having troubles (maybe my bad or anything else) realated to Stateless Seam component.

      I have a stateless session bean marked as @Stateless and also I wrote @Scope(ScopeType.STATELESS) (this is redundant according the docs.), this component is used to populate a @DataModel to the page with a list of users, and also it has some properties like the column that it will be used to sort, and the sorting ascending/descending property.

      Then, the first time I log in and display the list, all works fine.
      By instance suppose the first time the column for odering the list is "username" (This is setted everytime the component is created), then suppose I change the sorting to another column e.g. "email".

      Well, at this point all looks fine, there's no problem yet.
      Then I log out from the application (#{identity.logout}), then I log in back and when I display the list I notice the sorting column still is "email", but it supposes it should be "username" (called when the component is created).

      So, here is my question (I see 3.1.1 and 3.2.1 of seam reference, maybe I'm misunderstanding something):

      Does ScopeType.STATELESS components lives more than the user session?

      Are they instantiated only one time in the application (like Application context)?

      I don't know why I'm getting this behaviour in the stateless component, please clear me this up.

      Thanks in advance.





        • 1. Re: ScopeType.STATELESS misunderstanding
          gavin.king

          I *strongly* recommend you get a good book on EJB (for example the Bill Burke / RMH book from O'Reilly).

          The definition of "stateless" in the EJB spec is a limitation upon *you*. The container can do anything it likes! What the spec says is that *you* are not allowed to keep any state *relating to the client* in the bean.

          • 2. Re: ScopeType.STATELESS misunderstanding
            fernando_jmt

            It absolutely was my fault. Even 3.2.1. section of the book says it to me:
            "They may be used as JSF action listeners, but cannot provide properties to JSF components for display."

            Sorry :(