title: How to use setProjection correctly?
body: <p>I want to retrieve only certain columns in my UserAccount class so I have the code below:    </p>
  
  <pre><code>UserAccount aUser = (UserAccount)currentSession().createCriteria(UserAccount.class)
                          /*  .setProjection(Projections.projectionList()
                                      .add(Projections.property("id"))
                                      .add(Projections.property("username"))
                                      .add(Projections.property("email"))
                                      .add(Projections.property("displayname"))) */
                              .add(Restrictions.eq("email", email))
                              .add(Restrictions.eq("password", password))
                              .add(Restrictions.eq("enabled", true))
                              .add(Restrictions.eq("role", Role.CUSTOMER))
                              .uniqueResult();
      System.out.println(aUser);
      return aUser;
  </code></pre>
  
  <p>I got the null in return. But If I comment out the setProjections, I will get the user with all the properties. How can I use setProjection correctly in this case?</p>