1 Reply Latest reply on Jan 6, 2011 9:25 AM by Gab Aldian

    Long running conversation ends automatically without I request it

    Gab Aldian Newbie

      Hello


      I am having quite a problem with conversations. Theoretically it should span multiple interactions (according to the documentation), but actually it behaves as requests:


      I have a JSF page which displays a list of objects from the database, with selection checkboxes. An edit button allows to display a hidden form, and an Ajax request pre-fills the form with the characteristics of the selected item. At this stage, I call manually a method which has the @Begin annotation to start a long running conversation and I set a lock object for that item.


      What I would like is that when the users finish to edit the form and click on the submit button, the second Ajax request updates the item state, and I remove the lock. There would be no problem if the conversation was truly a long running one. But due to some unknown reason, seam decides on its own to end the long running conversation at the end of the first Ajax request. And so it automatically starts a new conversation for the second ajax request, and I get a null pointer exception when I try to operate the lock.


      I tried a lot of tricks, but didn't manage to force seam to do its job. Do you have any advice? Thank you in advance.

        • 1. Re: Long running conversation ends automatically without I request it
          Gab Aldian Newbie

          It's alright I finally found the problem.
          You can't have:





          in the xhtml

          #{mybean.methodlambda}



          and in the bean

          @Begin
          public void begin(){
             some initialization code
          }
          
          public void methodLambda(){
              begin();
              some specific code
          }




          But instead, you have to use:



          in the xhtml

          #{mybean.methodlambda}



          and in the bean

          public void begin(){
             some initialization code
          }
          
          @Begin
          public void methodLambda(){
              begin();
              some specific code
          }




          In other words, the begin annotation must be placed on the method which is called from the jsf page, otherwise it doesn't work.