2017-01-23 79 views
0

我有一個基於Spring Web模型 - 視圖 - 控制器(MVC)框架的項目。 Spring Web模型 - 視圖 - 控制器(MVC)框架的版本是3.2.8。hql.ast.QuerySyntaxException:運行查詢的意外令牌

我有一個異常運行1個查詢

 at weblogic.work.ExecuteThread.run(ExecuteThread.java:254) 
Caused By: org.hibernate.hql.ast.QuerySyntaxException: unexpected token: app near line 1, column 106 [ select company.id from com.tdk.iot.domain.Application app where app.androidId is not null app.status in (:status) join app.firstSignatory.company as company where company.logo is not null ] 
     at org.hibernate.hql.ast.QuerySyntaxException.convert(QuerySyntaxException.java:31) 
     at org.hibernate.hql.ast.QuerySyntaxException.convert(QuerySyntaxException.java:24) 
     at org.hibernate.hql.ast.ErrorCounter.throwQueryException(ErrorCounter.java:59) 
     at org.hibernate.hql.ast.QueryTranslatorImpl.parse(QueryTranslatorImpl.java:258) 
     at org.hibernate.hql.ast.QueryTranslatorImpl.doCompile(QueryTranslatorImpl.java:157) 
     at org.hibernate.hql.ast.QueryTranslatorImpl.compile(QueryTranslatorImpl.java:111) 
     at org.hibernate.engine.query.HQLQueryPlan.<init>(HQLQueryPlan.java:77) 
     at org.hibernate.engine.query.HQLQueryPlan.<init>(HQLQueryPlan.java:56) 
     at org.hibernate.engine.query.QueryPlanCache.getHQLQueryPlan(QueryPlanCache.java:72) 
     at org.hibernate.impl.AbstractSessionImpl.getHQLQueryPlan(AbstractSessionImpl.java:133) 
     at org.hibernate.impl.AbstractSessionImpl.createQuery(AbstractSessionImpl.java:112) 
     at org.hibernate.impl.SessionImpl.createQuery(SessionImpl.java:1623) 
     at org.hibernate.ejb.AbstractEntityManagerImpl.createQuery(AbstractEntityManagerImpl.java:93) 
+1

你是第一個和第二個條件之間缺少'和'的'and where'條款? – VPK

+0

請轉換爲答案 –

回答

0

你缺少在WHERE子句條件,

SELECT company.id 
FROM com.tdk.iot.domain.application app 
WHERE app.androidid IS NOT NULL AND app.status IN (:status) 
JOIN app.firstsignatory.company AS company 
WHERE company.logo IS NOT NULL