Why does my for loop check only the first element?
问题 I have this method that checks the username and password of a user before login. Now my for loop checks only the first item, it finds that the first condition, u.getRole().equalsIgnoreCase("recruiter") is not satisfied for the first item, so instead of going and checking the second item it just breaks and returns null. Why does this happen? Here is my method: public User check(String userName, String password) throws AdException { try { begin(); Query q = getSession().createQuery("from User")