title: Why can't I get result list, from a query?
body: <p>I want to login my users only if their account is activated, but for some reason the query that should return me the user (I call it Role in my program) when given the correct credentials, does not retrieve anything at all.</p>
  
  <p>I am 100% sure that the credentials are correct, also I'm sure that there are no duplicates in the database and the query syntax is correct.</p>
  
  <p>So why doesn't this method inside one of my EJBs returns true?:</p>
  
  <pre><code>// Checks if the account is not activated!
      public boolean isActivated(String email, String password) {
          // 1-Send query to database to see if that user exist
          Query query = em
                  .createQuery("SELECT r FROM Role r WHERE r.email=:emailparam AND r.password=:passwordparam");
          query.setParameter("emailparam", email);
          query.setParameter("passwordparam", password);
  
          List&lt;Object&gt; tmpList = query.getResultList();
          if (tmpList.isEmpty() == false) {
              System.out.println("IS NOT EMPTY");
              Role role = (Role) tmpList.get(0);
              if (role.getAccountStatus().trim()
                      .equalsIgnoreCase(AccountStattus.ACTIVATED.toString())) {
                  // The account is activated!
                  System.out.println("ACTIVATED!!!!!!!");
                  return true;
              }
          }
          // The account is not activated!
          System.out.println("NOT ACTIVATED!!!!!!!");
          return false;
      }
  </code></pre>
  
  <p>The only message i see in the console is <em>NOT ACTIVATED!!!!</em></p>
  
  <p><b>Update</b></p>
  
  <p>To comfirm that the list is empty at 100% I modified my code to look like this:</p>
  
  <pre><code>// Checks if the account is not activated!
      public boolean isActivated(String email, String password) {
          // 1-Send query to database to see if that user exist
          System.out.println("HERE:" + email+password);
          Query query = em
                  .createQuery("SELECT r FROM Role r WHERE r.email=:emailparam AND r.password=:passwordparam");
          query.setParameter("emailparam", email);
          query.setParameter("passwordparam", password);
  
          List&lt;Object&gt; tmpList = query.getResultList();
          Iterator&lt;Object&gt; it = tmpList.iterator();
          int elements = 0;
          while(it.hasNext()) { 
                 elements++;
               }
  
  
          if (elements &gt; 0) {
              System.out.println("IS NOT EMPTY");
              Role role = (Role) tmpList.get(0);
              if (role.getAccountStatus().trim()
                      .equalsIgnoreCase(AccountStattus.ACTIVATED.toString())) {
                  // The account is activated!
                  System.out.println("ACTIVATED!!!!!!!");
                  return true;
              }
          }
          // The account is not activated!
          System.out.println("NOT ACTIVATED!!!!!!!");
          return false;
      }
  </code></pre>
  
  <p>The method still returns false when I enter the correct credentials. What is wrong?</p>