2016-12-16 33 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());