I wrote HQL query like this in Hibernate:
User userLogIn = (User) entityManager .createQuery("from User as u where u.userName=:uname and u.passWord=:pwd") ...