java - Syntax error in HQL Query "unexpected token" -
i using select query in hql. cannot use in api.
getting error :
org.hibernate.hql.internal.ast.querysyntaxexception: unexpected token:
can tell me wat error in hql
code reference:
session session = sessionutil.getsession(); query query = session.createquery("select a.mobile, a.email, p.patientid (select l " + "from login l email= :email , password= :password) inner join patientprofile p on a.loginid= p.loginid"); query.setparameter("email", email); query.setparameter("password", password); list<login> logins = query.list(); session.close(); return logins;
i use native query instead, because both hql , jpql accept subqueries in select, or having clause can use :
query query = session.createnativequery("select a.mobile, a.email, p.patientid " + "(select * login l email= :email , password= :password) " + "inner join patientprofile p on a.loginid= p.loginid"); query.setparameter("email", email); query.setparameter("password", password);
read more in jpql documentation
subqueries
may used inwhere
orhaving
clause.
Comments
Post a Comment