4 Replies Latest reply on Oct 29, 2006 5:42 PM by Seto Kaiba

    Can't load the data from the view

    Seto Kaiba Expert

      I just coded as the example dvdstore, I'm cofused about loading the data from the view. In the view #{rs==null} return true. Does it need some other codes or settings to load the data ignored in the example?

      /**
       *
       */
      package cn.net.kdc.action.cms;
      
      import java.util.*;
      import javax.ejb.*;
      import javax.persistence.*;
      
      import org.jboss.seam.*;
      import org.jboss.seam.annotations.*;
      import org.jboss.seam.annotations.datamodel.*;
      
      import cn.net.kdc.domain.global.*;
      
      /**
       * @author Seto
       *
       */
      @Stateful
      @Name("haha")
      @Scope(ScopeType.SESSION)
      public class Haha implements IHaha {
       @PersistenceContext
       private EntityManager entityManager;
      
       @DataModel
       List rs;
      
       public String getTest() {
       return entityManager.find(Resource.class, 1).getTag();
       }
      
       public String getMm(){
       return ((Resource)rs.get(0)).getTag();
       }
      
       @Factory("rs")
       public void gets(){
       rs = entityManager.createQuery("from Resource resource").getResultList();
       }
      
       @Destroy
       @Remove
       public void destroy() {
      
       }
      }