5 Replies Latest reply on Apr 7, 2008 5:45 PM by trouby

    Conversational

    trouby

      Hey,


      I'm having a weird behavior,


      I have a seam stateless EJB bean component that is scoped as CONVERSATION with some properties, something very simple as:


      @Name("myComp")
      @Stateless()
      @Scope(CONVERSATION)
      public class MyCompBean implements MyCompManager {
        String description;
        //get/set
      }
      




      And s:link tag with

      propagation=begin

      which redirects to a page with a form that binds an input field to myComp.description:


      this is the page:



      <h:form>
      <h:inputText value="#{myComp.description}"/>
      <h:commandButton action="#{myComp.submitData}"/>
      </h:form>
      



      Pressing the link starts a long running conversation as expected and when submitting the form the data is binded to the component just fine.



      Now, after pressing another button with

      propagation=none

      I could see that the long running conversation still exist but is not active anymore, this is ok but when redirecting back to to the page above I still see the description field with the data I submitted before attached to the component,



      The weird thing is, even when I logout and re-login, going to the link still shows the old(description property) data,


      'debug.seam' page does not show any long running conversation, I was also making sure that my component has no instances in application scope or session scope
      So where is the old data kept?



      Thanks,


      Asaf.

        • 1. Re: Conversational
          damianharvey.damianharvey.gmail.com

          After you log out how are you getting back to the page? Are you clicking the Back button or clicking on a link? It sounds like the behavior you see when clicking a Back button and the browser has kept the value of text fields as it isn't doing a reload.


          Cheers,


          Damian.

          • 2. Re: Conversational
            trouby

            No,


            I am redirecting the page or by pressing the button (which is just a normal link with

            propagation=begin

            or just hitting the page again,



            Of course I'm not using the back button,




            Asaf.

            • 3. Re: Conversational
              trouby

              More to say,


              After pressing the button that redirects to the form a new long running conversation is started,


              When I check in debug.seam, I see the new conversation and the component already has all the properties filled up with the old data,



              So for every new conversation that is started, I see the old data within the component attached to the created conversation,



              Weird, isn't it? :-)



              Thanks,
              Asaf.

              • 4. Re: Conversational
                pmuir

                I have a seam stateless EJB bean component that is scoped as CONVERSATION with some properties, something very simple as:

                This will cause you all sorts of problems with field data consistency (and others). Read about what @Stateless really means.

                • 5. Re: Conversational
                  trouby

                  Weird, I have another class that always worked,


                  Yes, I could figure out that sometimes the stateless bean instance keeps alive for longer time although I was sure it is really stateless :)



                  So what's the best way? this component is annotated as stateless since it is based on many other stateless/stateful beans,
                  so I thought the safest way is to inject EJBs by container,


                  I can use initialContext in order to use EJBs but it's less comfortable and less elegant,



                  What are my other options? I can make the component a normal POJO , make all EJBs seam components and inject all the EJBs via @In but I'm not sure it is safe enough to inject many stateless/stateful EJBs that way, is it?


                  What's the best from both options? or there's a better approach?


                  Many thanks,


                  Asaf.