6 Replies Latest reply on Mar 12, 2008 5:03 PM by pmuir

    Methods with no annotations in a Seam POJO

    robbins

      Hi,
      Excuse this simple question.
      I have a Seam POJO which has a conversation scope.
      I have methods annotated with @begin and @end annotations.
      I have a few more methods that have no annotations.
      Now I am wondering what sort of context do this methods have vis a vi Seam conversations if they are invoked:
      1. Within a conversation
      2. When there is no conversation active.


      I am guessing the answer is
      For 1. Seam treats it as a method invocation inside the conversation, all objects in the conversation are accessible.
      For 2. Seam creates and ends a conversation for the durations of this method.


      Is this correct?


      Thanks a million.

        • 1. Re: Methods with no annotations in a Seam POJO
          trouby

          If you have defined the component with CONVERSATION scope then you'll have a POJO instance per conversation,


          Any invocation is a conversation, if you have started a long running conversation than any invocations for other methods in the POJO would be invoked over the component that is available in the current long running conversation.




          Asaf.

          • 2. Re: Methods with no annotations in a Seam POJO
            robbins

            Asaf S wrote on Mar 07, 2008 07:00 PM:


            If you have defined the component with CONVERSATION scope then you'll have a POJO instance per conversation,

            Any invocation is a conversation, if you have started a long running conversation than any invocations for other methods in the POJO would be invoked over the component that is available in the current long running conversation.



            Asaf.


            thanks Asaf. What if I end the conversation by invoking amethod annotated with @End, then I invoke another method on the same POJO which has no Seam annotation, does Seam automatically start another conversation? It's difficult to figure out what's it doing from the logs.

            • 3. Re: Methods with no annotations in a Seam POJO
              robbins

              Note I am not using the (ifNotBegunOutcome) either.

              • 4. Re: Methods with no annotations in a Seam POJO
                tom_goring


                What if I end the conversation by invoking amethod annotated with @End, then I invoke another method on the same POJO which has no Seam annotation, does Seam automatically start another conversation? It's difficult to figure out what's it doing from the logs.

                Say your @End method was called during an action event, your long running conversation would be marked to end... however your context will only finish at the end of the http request/post.  So if you called another method your object would exist.  In a subsequent http request a new context object would be created in a short lived (tmp) conversation.... until you call your next @Begin.


                I'd recommend you reread the seam docos it took me a while to understand what @Begin/@End do and when best to use them.

                • 5. Re: Methods with no annotations in a Seam POJO
                  robbins

                  Believe me, I have read the docs.
                  Are you saying that for a POJO marked with @Scope(CONVERSATION), @Begin and @End denote the beginning and end for a long running conversation, whereas any other method called after @End, in a separate Http request is just a short lived conversation?


                  Thanks

                  • 6. Re: Methods with no annotations in a Seam POJO
                    pmuir

                    Tony Robbins wrote on Mar 12, 2008 04:00 PM:


                    Believe me, I have read the docs.
                    Are you saying that for a POJO marked with @Scope(CONVERSATION), @Begin and @End denote the beginning and end for a long running conversation, whereas any other method called after @End, in a separate Http request is just a short lived conversation?

                    Thanks


                    Correct.