5 Replies Latest reply on Sep 5, 2013 8:58 AM by Wang Liyu

    Conversations... Ending and Starting a new conversation in another controller.

    Tony Herstell Master

      [The "CRUD" bean...]

      I am "leaving" a bean (and conversation) via:

       public String back() {
            this.logger.info(">>>Back");
            finishMyConversation();
            this.logger.info("<<<Back");
            return this.actionManagementController.init();
         }
      

       

      (In parent class...)

         protected void finishMyConversation() {
            if (!this.getConversation().isTransient()) { // May have been an error (don't
               // get trapped on the page).
               this.getConversation().end(); // END THE LONG RUNNING CONVERSATION
            }
         }
      

       

      [The "Manage The List" bean...]

      The call to actionManagementController.init (in another @Injected bean) is, now, starting a new conversation

         // land here off a menu click...
         public String init() {
            this.logger.info(">>>init");
            startMyConversation();
            setShowIds(false);
            this.logger.info("<<<init");
            return "pretty:manageActions";
         }
      

       

      (In parent class...)

       protected void startMyConversation() {
            // Start a Conversation
            if (!this.getConversation().isTransient()) {
               this.getConversation().end();
            }
            this.getConversation().begin(); // START THE LONG RUNNING CONVERSATION
         }
      

       

      What I see happening is the conversation seems to be carried on...

       

      I don't see any side-effects (yet) but is there a way to "really" end a conversation and force a new one to be started?

       

      I originally had this done the Seam 2 way...  that one bean was Sessions scoped and contained a list of "things" to "do stuff to" (like the hotel example in Seam2)... This would launch into the other bean and start a conversation to "do stuff" to the thing you had picked... This initially seemed to work fine, but then I kept getting problems as the sessions bean was coming up with "old" versions of the objects (from a bit of reading its a "feature" of Hibernate).