Hello, I'm trying to get the number of Users depending on their intranet and the beginning of their lastnames.
Code:
public int getNbUsersAlpha(Intranet intranet, String alpha){
      if(intranet!=null){
         return this.getSession().createQuery("select count(*) from User where intranet=? and lastName like concat(?,'%')").setParameter(0, intranet).setParameter(1, alpha).list().size();
      }
      else{
         return this.getSession().createQuery("select count(*) from User where intranet is null and lastName like concat(?,'%')").setParameter(0, alpha).list().size();
      }
   }
However, this always returns 1.
Any ideas ?