2 Replies Latest reply on Jun 18, 2010 2:55 AM by Ben Utzer

    ideal pattern on list generation for tables, selects, etc.

    Dean Hiller Expert

      Currently, we always create lists in session or conversation because it just works and fills the table in and then when we have the EL #{actionbean.edit(var)} it works because the list is still there.  IDEALLY though, we don't want lists clustered accross the nodes(especially all the session ones that are only session because we don't want a long running conversation on those pages at all since they are directly accessible. 


      So ideally, we want something like this(for every bean that pretty much gets edited via those tables or select one menus or pulldowns).....


      AND this is like a very typical situation where you have a list, edit, add or delete an entry.  It would ROCK if seam could just generate this pattern for us including the next page's form too!!!!


      @Name("faqActions")
      @Scope(ScopeType.EVENT)
      public class FAQActions extends ActionBase {
      
           @Out(scope=ScopeType.PAGE)
           private List<FAQ> faqs;
           
           @In(required=false)
           @Out(required=false)
           private FAQ faq;
           
           public void initialize() {
                faqs = FAQ.findAll(entityManager);
           }
           
           public List<FAQ> getFaqs() {
                return faqs;
           }
      
              @Begin(flushMode=FlushModeType.MANUAL)
           public void add() {          
           }
      
              @Begin(flushMode=FlushModeType.MANUAL)
           public void edit(FAQ faq) {
                faq = entityManager.find(FAQ.class, faq.getId());
           }
              @Begin(flushMode=FlushModeType.MANUAL)
           public void delete(FAQ faq) {
                faq = entityManager.find(FAQ.class, faq.getId());
           }
      
           //please implement me if need save....
              @End
           protected void save() {
                if(faq.getId() == null)
                     entityManager.persist(faq);
                      entityManager.flush();
           }
              @End     
           public void confirmDelete() {
                entityManager.remove(faq);
                      entityManager.flush();
           }
           
      }
      



      Of course, this doesn't work and edit with a null param is passed in!!!  Is there any way to do this type of pattern where all the lists are not in the session which would mean all the lists are clustered :(.