2 Replies Latest reply on Jan 15, 2009 1:28 PM by matthieugd

    out and observer

    matthieugd

      Hello,


      I have a stateful bean with a variable decorated with @in and @out annotations. Like in the booking sample, I refresh this variable after an action is completed from a nested stateful bean conversation.


      This method decorated with observer annotation is correctly called and my page show the data refreshed. BUT when I refresh/reload the page I see the data before the update/refresh. and when I look the debug.seam page I see my object in the conversation scope but it's the old one, before the refresh.


      My question is : since my variable has an @out annotation when I refresh it in the observer method it should be oujected in the conversation stack, isn't it ?


      My stateful bean :



      @Stateful
      @Name("consultation")
      @Scope(ScopeType.CONVERSATION)
      public class ConsultationBean implements Consultation {
      
              @In(required=false) @Out
           private Compte compte;
      
              @Observer({"mouvementMAJ","creationMAJ","cloture"})
           public void refresh()
           {
                log.debug("refresh demande");
                compte = service.consulteCompte(dossier.getNum());
           }     
              
      }



        • 1. Re: out and observer
          matthieugd
          The observer is called from a statetful bean from a nested conversation ended :



          `@Stateful
          @Name("creationMvt")
          @Scope(ScopeType.CONVERSATION)
          public class CreationMvttBean implements CreationMvt {

               public void creerLeMouvement() {
               
                     //stuff to update base     
                  events.raiseTransactionSuccessEvent("creationMAJ");
                  }

          }`



          in pages.xml :


          <page view-id="/creerMount.xhtml">
                <description>Création</description>   
                 <navigation from-action="#{creationMouvement.creerLeMouvement}">              
                      <rule if="#{creationMouvement.mouvementValid}">
                           <end-conversation />
                           <redirect view-id="/consulterCompte.xhtml"/>                  
                       </rule>
                 </navigation>       
          </page>
          • 2. Re: out and observer
            matthieugd

            I forget to mention that the nested conversation has a compte injected, here  is the code :


            @Stateful
            @Name("creationMvt")
            @Scope(ScopeType.CONVERSATION)
            public class CreationMvttBean implements CreationMvt {
                    @In @Out
                 private Compte compte;
            
             @End(root=false)
             public void creerLeMouvement() {
                         //stuff to update base
                         service.update(compte,blabla)
                         events.raiseTransactionSuccessEvent("creationMAJ");
                    }
            
            }



            When I test this  in the observer method I got true ?


            log.debug("Conversation ID : "  Conversation.instance().isNested());