[PersistenceException: org.hibernate.exception.SQLGrammarException: could not execute query]
- by doniyor
i need help. i am trying to select from database thru sql statement in play framework, but it gives me error, i cannot figure out where the clue is. here is the code:
@Transactional
public static Users findByUsernameAndPassword(String username, String password){
String hash = DigestUtils.md5Hex(password);
Query q = JPA.em().createNativeQuery("select * from USERS where" + "USERNAME=? and PASSWORD=?").setParameter(1, username).setParameter(2, password);
List<Users> users = q.getResultList();
if(users.isEmpty()){
return null;
} else{
return users.get(0);
here is the eror message:
[PersistenceException: org.hibernate.exception.SQLGrammarException: could not execute query]
can someone help me please! any help i would appreciate!
thanks