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

Popular posts from this blog

java - Jasper subreport showing only one entry from the JSON data source when embedded in the Title band -

serialization - Convert Any type in scala to Array[Byte] and back -

SonarQube Plugin for Jenkins does not find SonarQube Scanner executable -