0 Replies Latest reply on Jul 3, 2007 9:59 AM by grdzeli_kaci

    Richfaces Tree and Seam EntityManager Problem

      hi all,
      i use seam and richfaces together, i have generated tree components from database, everything works fine i see tree components that containing information from database, but when i tried to expand tree component i got an error

      Caused by: org.jboss.seam.RequiredException: In attribute requires non-null value: menu.entityManager
      

      why get entitymanger null ??
      here is my example:
      @Name("menu")
      @Scope(ScopeType.SESSION)
      public class MenuBean{
      
       @In
       private EntityManager entityManager;
      
       private HtmlPanelBar bar = new HtmlPanelBar();
       public MenuBean() {
       }
      
       public HtmlPanelBar getBar() {
       if (bar!=null && bar.getChildren()!=null) {
       bar.getChildren().clear();
       }
      
       ArrayList<Menu> arraylist = (ArrayList<Menu>)entityManager.createNamedQuery("Menu.findAll").getResultList();
       for (Menu elem : arraylist) {
       HtmlPanelBarItem item= new HtmlPanelBarItem();
       item.setLabel(elem.getDescriptionId().getDescription());
      
       Library library = new Library(entityManager);
      
       HtmlTree tree = new HtmlTree();
       tree.setStyle("width:150px");
       tree.setValue(library.getData());
       tree.setVar("item");
       tree.setNodeFace(library.getType());
      
       Iterator<MenuGroup> iteratMenuGroups = elem.getMenuGroupCollection().iterator();
       while (iteratMenuGroups.hasNext()) {
       MenuGroup menuGroup = iteratMenuGroups.next();
       HtmlTreeNode treenodeMenuGroup = new HtmlTreeNode();
       treenodeMenuGroup.setType("menugroup");
       HtmlOutputText textMenuGroup = new HtmlOutputText();
       textMenuGroup.setTitle(menuGroup.getDescriptionId().getDescription());
       treenodeMenuGroup.getChildren().add(textMenuGroup);
      
       tree.getChildren().add(treenodeMenuGroup);
       }
       item.getChildren().add(tree);
       bar.getChildren().add(item);
      
       /*
       *Iterator<Article> iteratArticles = menuGroup.getArticleCollection().iterator();
       while (iteratArticles.hasNext()) {
       Article article = iteratArticles.next();
       HtmlTreeNode treenodeArticle = new HtmlTreeNode();
       treenodeArticle.setType("article");
       HtmlOutputText textArticle = new HtmlOutputText();
       textArticle.setTitle(article.getDesctiptionId().getDescription());
       treenodeArticle.getChildren().add(textArticle);
       }
       */
       }
       return bar;
       }
       public void setBar(HtmlPanelBar bar) {
       this.bar = bar;
       }
      }
      
      


      is this known issue ??
      any idea will be appreciated,

      ____________________
      Regards,
      Paata.