0 Replies Latest reply on Jun 18, 2009 6:58 PM by pwnell

    rich:dataTable and state issue

    pwnell

      I am using the rich:dataTable control backed by a stateful session bean, session scoped to handle a grid of data.  This works fine.  However, I'd like to know whether it is possible to not make use of a stateful session bean for this?  The problem is I need to switch the source for this grid based on a user account selection.  Since the @Factory is only called once to create this bean, it is never called again to load the new data source once the user selects another account.  Here is an exert of my backing bean:




      @Stateful
      @Scope(ScopeType.SESSION)
      @Name("custTransactionManager")
      public class CustAccountTransactionManagerBean implements CustAccountTransactionManager {
      
          @In
          private CompositeProfileInfo compositeProfileInfo;
      
          @DataModel
          private List<AccountTransaction> custTransactionList;
      
          @DataModelSelection
          @Out(required = false)
          private AccountTransaction transaction;
      
          public CustAccountTransactionManagerBean() {
          }
      
          @Factory("custTransactionList")
          public void loadTransactions() {
              csaCustTransactionList = compositeProfileInfo.getTransactionList();
      
              // clear the selected item from the context
              transaction = null;
          }
      
          public void select(int row) {
              transaction = custTransactionList.get(row);
      
              // Fetch details
              new TransactionSessionAdapter().loadTransaction(transaction.getId(), transaction, GlobalState.getUserState());
          }
      
          @Remove
          @Destroy
          public void destroy() {
              System.out.println("Zapping AccountManager");
          }
      }
      




      So how do I either remove this stateful session bean after the user navigates away from this page, or not use a stateful session bean at all but still maintain state across clicking on the rows/page numbers in the grid?  What is the best solution?