4 Replies Latest reply on Apr 4, 2007 1:14 AM by surajmundada

    problem with Conversation scope

    surajmundada Newbie

      Hi,

      I am using Seam 1.0.0 GA.

      We have used Conversation scope for our listeners (stateless session beans).

      Recently I found that whenever any of the method in listener is called from my xhtml pages, all the factory methods in that session bean also get executed before the called method. Why is that so and can I do something to prevent these factory methods getting executed ?

      Also, I am not clear about using conversation scope.

      In most of session beans, we have used conversation scope without @Begin and @End annotations or say default conversation scope.

      According the Seam documentation, default conversation lasts only for one reqeust and it's response. Accordingly, is it that the seam variables which are outjected in a request execution last only for that request and no longer available in the execution of next request ?

      Regards,

      Suraj

        • 1. Re: problem with Conversation scope
          Mike Quilleash Newbie

          To me using conversation scope for a stateless bean sounds wrong. If your component has no state then it may as well be in the Seam stateless scope.

          The @Out annotation will outject a component back into the relevant Seam context. How long that outjected reference survives for is dependent on the scope of the outjected component, not the component that is outjecting it.

          HTH.

          Mike.

          • 2. Re: problem with Conversation scope
            surajmundada Newbie

            Hi,

            thanks for replying.

            we are using conversation scope to display the previous pages (without loss of state) when user clicks the browser Back button.

            I am not sure if I can specify scope of a variable seperately in Seam 1.0.0 GA (Please correct me if I am wrong) In that case, scope of that variable should be same as the scope of the seam component in which it is defined.

            now, the problem I am facing with conversation scope is some of seam variables, after they are outjected are availabe throughout the application while some are not. As a workaround, we have to explicitly set those variables in the session context and fetch them back at the required place.

            Till now, it's working fine. But we don't want many workarounds of this type.

            Also, my problem of factory methods getting called when other methods of session bean are executed has not solved yet.

            Has it to do anything with Conversation scope ?

            Is it possible that DataModel ( or other variables for which factory method are defined) looses it's value after one request execution (in conversation scope ) and because it has no value when request comes to that bean again, factory method gets executed ?

            waiting for reply,

            suraj

            • 3. Re: problem with Conversation scope
              Pete Muir Master

              @Out(scope=) is in 1.0.

              Any variables outjected into a conversation scope will be available for it's duration. @DataModel annotated variables are, indeed, outjected into the scope of the owning component.

              You should really develop against 1.2 as there were a lot of improvements to the core and you'll be lucky to get much help here for 1.0

              • 4. Re: problem with Conversation scope
                surajmundada Newbie

                Thanks for all the help :)

                Regards,

                Suraj