2 Replies Latest reply on Nov 8, 2007 10:42 AM by ng.tech

    Problems retrieving nested conversation id

    ng.tech

      Hello there,

      I'm using seam CR2 and I'm having problems retrieving the conversation id of a nested conversation.

      Example:

      @Begin
      public void startNormalConv(){
      Conversation.instance().getId();
      }

      The above code retrieves the Id of the conversation that was just created.

      But if I'm trying:

      @Begin(nested=true)
      public void startNestedConv(){
      Conversation.instance().getId();
      }

      It will give me the Id of the parent conversation of and not the Id of the new nested one.

      Is this a "normal" behaviour ?
      Is there any way I can retrieve the Id of the new nested conversation in the current code ?

      Thanks a lot,
      Regards

        • 1. Re: Problems retrieving nested conversation id

          You have to understand the semantics of @Begin here. The @Begin annotation does not start a long-running conversation until the method execution completes. In your case the nested conversation will always begin as your return type is void, but if you were to have a String return type (for navigation) only a non-null return value would start the conversation.

          The first case works because Seam always begins a temporary conversation if a long-running conversation is not in progress. Then if @Begin is encountered on a method and the method is void or returns a non-null value the conversation is *promoted* to long-running after method execution.

          So to answer your second question, in order to retrieve the nested conversation id, of course the conversation must be in progress...

          If your method needs access to the id you could either programmatically begin the nested conversation and then get the id, begin the conversation through s:conversationPropagation in the view, or begin the nested conversation through pages.xml navigation rules (my preferred approach).

          Each of these approaches are described in the documentation.

          • 2. Re: Problems retrieving nested conversation id
            ng.tech

            Hey,

            Ok perfect, thanks a lot for the explanation. I'm still currently learning the framework and there is a lot to read.

            Regards,