5 Replies Latest reply on Nov 29, 2009 7:30 PM by I need a real name

    rowCount and EntityManager

    I need a real name Newbie

      Hello,


      I want to see how many users are registered:



      <h:outputText styleClass="outputText" value="#{userList.rowCount} Users"/>





      @Stateless
      @Name("registrationStats")
      public class RegistrationStats implements RegistrationStatsInterface {
           
           @PersistenceContext
           private EntityManager entityManager;
           
           @DataModel     
           private List<User> userList;
           
           @Factory("userList")
           public void populateUserList() {
                userList = entityManager.createQuery("SELECT COUNT(*) FROM User").getResultList();
           }
      }





      @Local
      public interface RegistrationStatsInterface {     
           public void populateUserList();
      }




      But I always get 1 user registered.


      Please can you help me?