2016-11-02 81 views
0

子句之間使用有誰能夠告訴什麼是在請求中的問題:如何在HQL

@Query("SELECT new com.app.gsc.entities.ListeBI(lm.listeDeCriteres.designation,count(*) as totalNumber,lm.ficheDeMission.dateEtHeurDeDepart) from ListeDeControleDetailsMission lm where lm.boolDepart=false AND Year(lm.ficheDeMission.dateEtHeurDeDepart)=:year AND Month(lm.ficheDeMission.dateEtHeurDeDepart) >= Month(lm.ficheDeMission.dateEtHeurDeDepart)=:FromMonth AND Month(lm.ficheDeMission.dateEtHeurDeDepart) <= Month(lm.ficheDeMission.dateEtHeurDeDepart)=:ToMonth GROUP BY lm.listeDeCriteres.designation") 
List<ListeBI> getIncidentDepartByFromToMonth(@Param("FromMonth") int FromMonth, @Param("ToMonth") int ToMonth, 
     @Param("year") int year); 

錯誤消息:

Caused by: org.hibernate.hql.internal.ast.QuerySyntaxException: unexpected AST node: >= near line 1, column 322 [SELECT new com.app.gsc.entities.ListeBI(lm.listeDeCriteres.designation,count(*) as totalNumber,lm.ficheDeMission.dateEtHeurDeDepart) from com.app.gsc.entities.ListeDeControleDetailsMission lm where lm.boolDepart=false AND Year(lm.ficheDeMission.dateEtHeurDeDepart)=:year AND Month(lm.ficheDeMission.dateEtHeurDeDepart) >= Month(lm.ficheDeMission.dateEtHeurDeDepart)=:FromMonth AND Month(lm.ficheDeMission.dateEtHeurDeDepart) <= Month(lm.ficheDeMission.dateEtHeurDeDepart)=:ToMonth GROUP BY lm.listeDeCriteres.designation] 

回答

0

它必須是這一部分:Month(lm.ficheDeMission.dateEtHeurDeDepart) >= Month(lm.ficheDeMission.dateEtHeurDeDepart)=:FromMonth。我會說你的3次比較存在問題。