Link to home
Start Free TrialLog in
Avatar of Siddhardh
Siddhardh

asked on

unexpected token

I would like to retrieve count of the rows in ScanPT table.
I wrote this query in Hibernate console and got the result 2.

When i use it in my Java code it throws me ERROR org.hibernate.hql.PARSER - line 1:182: unexpected token: q
Can you tell me what iam doing wrong ?

public int checkForPT(long id) throws Exception{
      String sql = "select count(pt) from ScanPT as pt where pt.scanComp.id in " +
                         "(select tasks.id      from Queue as q      inner join q.scanCompany as tasks"+
                         "where q.company.id = ? )";
      List  pnrCount = getHibernateTemplate().find(sql,id);      
      int result = pnrCount.size();      
      return result;
      }
ASKER CERTIFIED SOLUTION
Avatar of TimCottee
TimCottee
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Siddhardh
Siddhardh

ASKER

Thanks Much Tim