2 Replies Latest reply on Aug 7, 2008 1:42 AM by admin.admin.email.tld

    How do I decide which ScopeType to user?

    holan

      I use ejb with seam;


      Here is the problem:If my component contains a dataModel,and I use on-demand-page.


      If I use the stateless or event scope.Every time I use dataScroller to get another page.
      The component should be create and after the render-response it will be destroy.So it means in every request it will query the dataBase twice.(first in the apply-request,2nd in the render-response.)


      If I use the Long-Running-conversation.Suppose I start a conversation and the use a s:link to jump to another page.The component's @End method may not be invoke.And the list is keep in the memery.If there is lots of concurrency user.Could it result the out-of-memery?


      I have another question.
      before I use pojo as backing bean, and ejb as business logic.
      But Seam managed to unite this.How does seam do this?
      I mean, if I write code like this


      @Stateful
      @Name("pb")
      @Scope(ScopeType.CONVERSATION)
      public class ProductBacking implements IProductBacking{
              private String name;
      
              public String getName() {
                      return name;
              }
              public void setName(String name) {
                      this.name = name;
              }
      }
      


      Is seam generate the Backing bean and compile it to java-byte-code.And invoke the stateful session bean?
      Or seam just generate the delegate at run time and use it to invoke the session bean?


      thanks,best regards!

        • 1. Re: How do I decide which ScopeType to user?
          admin.admin.email.tld

          Seam eliminates the JSF managed bean.  That's part of the idea of the glue code that Seam is for bridging JSF and EJB.  The JSF directly calls the session bean public methods via the local interface and expression language (EL) in the xhtml.


          If a temporary conversation is promoted to a long-running conversation via @Begin, it will either timeout or be demoted to a temporary conversation after the @End method is executed and then destroyed after the render response JSF life cycle phase. If the @End method is not executed on a LRC, then that is considered an abandoned conversation (which will eventually timeout or be destroyed if the session is destroyed or times out).


          @End instructs Seam to convert the long-running conversation to a temporary state after this method is invoked successfully.


          There is a beforeRedirect attribute for @End:


          If set to true, instructs Seam to terminate the temporary conversation prior to issuing a navigation redirect. The default is to propagate the conversation across the redirect and terminate it once the response is complete. Default: false.

          • 2. Re: How do I decide which ScopeType to user?
            admin.admin.email.tld
            Event = request scope
            Page is in JSF component tree.
            Conversation is subset of session (think multi-page wizards or shopping cart use cases)
            Session is session
            BPC is business process context for workflow/BPM use cases

            you will usually use conversation, event, page, session scopes.

            read Seam in Action, good book.