java ee - HQL query throws an EJB Exception -
i tryin write hql queries 2 tables related on 1 many relationship there error on execution.
string status = "vacant"; query query = em.createquery("select count(id) beds status=:status inner join rooms on beds.roomid=rooms.id rooms.hostelid=:hostelid"); query.setparameter("status", status); query.setparameter("hostelid", hostelid); list result = query.getresultlist(); return ((long)result.get(0)).intvalue();
the error trown
javax.ejb.ejbexception: java.lang.illegalargumentexception: org.hibernate.hql.internal.ast.querysyntaxexception: unexpected token: join near line 1, column 67 [select count(id) portal.beds.model.beds status=:status join rooms on beds.roomid=rooms.id rooms.hostelid=:hostelid]
Comments
Post a Comment