2 Replies Latest reply on Jan 26, 2009 2:26 PM by Matthieu Guyonnet-Duluc

    parent and nested conversation, explanation needed

    Matthieu Guyonnet-Duluc Newbie

      Hello,


      I hit a problem with a nested conversation (http://www.seamframework.org/Community/OutAndObserver) and I try to find my answer in the documentation but I can't find the right explanation.


      I've 2 stateful beans, with a property injected and outjected. The second one is called during a nested conversation. Here's the code:



      @Stateful
      @Name("firstBean")
      @Scope(ScopeType.CONVERSATION)
      public class FirstBean implements First {
                
           @In(required=false) @Out
           private Property prop;
      
              @Begin
           public void  begin(String id) {
                
                prop = initProp(...);     
           }
      
      }



      If I unterstand correctly, prop will be oujected in the conversation context (here the parent one) ?


      In my page I got a s:link to begin a nested conversation ( propagation nest ). And when user click on a commandButton inside this page I call the second stateful bean :


      @Stateful
      @Name("secondBean")
      @Scope(ScopeType.CONVERSATION)
      public class SecondBean implements Second{
           
           @In @Out
           private Property prop;
      
              @End(root=false)
              public void update() {
                prop = update(...);
              }
      }



      Here after the update method, the prop is oujected but where ? in the nested conversation or the parent conversation ?


      In the page rendered after the update() method I see the prop updated but if I refresh the page I see the old prop from the First bean.
      If I display the Seam debug page and list the variables of the conversation I see the old prop.


      If I resume I got this :


      FirstBean.begin(id) => page1.xhtml with prop(ParentConversation)


      => s:link , nested begin => page2.xhtml button


      => SecondBean.update() with injected prop(Parent) oujected as prop(Nested)


      => nested conversation ended => page1.xhtml displayed with prop (Nested)


      => refresh page1 I got prop (Parent)


      If I change the @End annotation to add beforeRedirect=true, I see page1.xhtml with prop(Parent)


      How can I refresh the prop in the parent conversation ?


      Matthieu