Example #1
0
 private List<User> convertToUser(List results) {
   List<User> users = new ArrayList<User>();
   for (Object result : results) {
     User user = new User();
     Object[] obj = (Object[]) result;
     user.setId((Integer) obj[0]);
     user.setUserName((String) obj[1]);
     user.setPassword((String) obj[2]);
     user.setEmail((String) obj[3]);
     users.add(user);
   }
   return users;
 }
Example #2
0
 @SuppressWarnings("unchecked")
 @Override
 public List<User> findUserByNameAndPwd(User user) {
   List<Object> results =
       getHibernateTemplate()
           .find(
               "select id, userName, password, "
                   + "email from User where userName = '******' and "
                   + "password = '******'");
   return this.convertToUser(results);
 }