3 Replies Latest reply on Jul 31, 2008 1:28 PM by holan zhang

    how to decide page's scope which has h:dataTable in it?

    holan zhang Newbie

      I use seam and I found the booking example has one problem.It use the ScopeType.Session as the HotelSearchAction's scope.So if a user click a table item.the jsf life cycle will not re-initialize the HotelSearchAction.
      (mostly often,if I use pojo,I just use request Scope,so if user click a table item. The jsf life cycle will re-initialize the pojo, and if the pojo has a dataModel, it will query the dataBase in the apply-request phase and the render-response phase,so it query the database twice).
      But if I use ejb Stateful bean. cause the bean is stateful,so it will not query the dataBase in the apply-request phase.This sollution is good.
      But here comes the problem.What scope should the stateful-bean has?
      If I use ScopeType.Session.(this is the booking example use).obviously there will be a memery-leak.If I have a lot of page which has a table,It will take a lot of memery.
      Should I use a ScopeType.Conversation.And decide the @begin and @end to limit the memery use?
      What is the Common Style to handle the h:dataTable involved Problem?It means Don't query the dataBase twice( in the apply-request and the render-respoonse phase) and don't use the Session Scope.