2016-12-16 38 views
0

我在我的Spring Web模型 - 視圖 - 控制器(MVC)框架中有這個類。 Spring Web模型 - 視圖 - 控制器(MVC)框架的版本是3.2.8。Hibernate HQL意外令牌與喜歡

,我必須在1個DAO

final StringBuilder queryString = new StringBuilder(" select app from Application app where upper (ticket_id) like :searchString and upper (id) like :searchString "); 

     queryString.append("where app.status != " + Status.READY.ordinal()); 

     queryString.append(" order by app.submissionTime desc "); 

     try { 

      final Query query = getEntityManager().createQuery(queryString.toString()); 

      searchString = searchString.replace("!", "!!") 
         .replace("%", "!%") 
         .replace("_", "!_") 
         .replace("[", "![") 
         .trim() 
         .toUpperCase(); 


      query.setParameter ("searchString", searchString);      

      return query.getResultList(); 

這種方法,但我對運行時此錯誤:

org. where near line 1, column 144 [ select app from com.tdk.devices.domain.Application app where upper (ticket_id) like :searchString and upper (id) like :searchString where app.status != 0 order by app.submissionTime desc ] 
+1

第144列是app.status的開始 - 與喜歡無關 – DaveRlz

回答

5

您使用 「where」 子句的2倍。首先在StringBuilder的構造函數中,然後:

queryString.append("where app.status != " + Status.READY.ordinal());