我想使用以下參數顯示所有未被回答且未被回答的清單(響應清單在ResponsesCheckLists表中):idequipement和idMission。JPA,JPQL:意外的令牌:左第1行左邊
antlr.NoViableAltException: unexpected token: LEFT
------
Caused by: org.hibernate.hql.internal.ast.QuerySyntaxException: unexpected token: LEFT near line 1, column 148 [SELECT check,resp,eq FROM com.SSC.DAO.Entities.Equipements eq INNER JOIN CheckLists check WHERE eq.idEquipements = check.equipements.idEquipements LEFT JOIN ResponsesCheckLists resp ON check.idCheckLists=resp.CheckLts.idCheckLists AND resp.Respmission.idMission = :idmiss WHERE eq.idEquipements = :idEqp ]
------
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'responsesCheckListsRepository': Invocation of init method failed; nested exception is java.lang.IllegalArgumentException: Validation failed for query for method public abstract java.util.List com.SSC.DAO.JPARepository.ResponsesCheckListsRepository.ListCheckListsNonRepondu(long,long)!
EDIT1:
@Query("SELECT check,resp,eq FROM Equipements eq INNER JOIN CheckLists check WHERE eq.idEquipements = check.equipements.idEquipements LEFT JOIN ResponsesCheckLists resp ON check.idCheckLists=resp.CheckLts.idCheckLists AND resp.Respmission.idMission = :idmiss WHERE eq.idEquipements = :idEqp ")
public List<ResponsesCheckLists> ListCheckListsNonRepondu(@Param("idEqp") long idEqp, @Param("idmiss") long idmiss);
運行此查詢,我顯示該錯誤消息之後
@Query("SELECT check,resp,eq FROM Equipements eq INNER JOIN CheckLists check ON eq.idEquipements = check.equipements.idEquipements"
+ " INNER JOIN ResponsesCheckLists resp ON check.idCheckLists=resp.CheckLts.idCheckLists AND resp.Respmission.idMission = :idmiss AND eq.idEquipements = :idEqp ")
public List<ResponsesCheckLists> ListCheckListsNonRepondu(@Param("idEqp") long idEqp, @Param("idmiss") long idmiss);
EDIT1的錯誤;
引起:java.lang.IllegalStateException:對於節點沒有任何數據類型: org.hibernate.hql.internal.ast.tree.IdentNode + - [IDENT] IdentNode: '檢查'{originalText =檢查}
antlr.SemanticException:加入的路徑!
造成的:java.lang.IllegalArgumentException異常:驗證失敗 查詢方法公共抽象的java.util.List com.SSC.DAO.JPARepository.ResponsesCheckListsRepository.ListCheckListsNonRepondu(很長很長)!
EDIT2:
@Query("SELECT check , resp , eq FROM Equipements eq INNER JOIN CheckLists check ON eq.idEquipements = check.equipements.idEquipements"
+ " INNER JOIN ResponsesCheckLists resp ON check.idCheckLists=resp.CheckLts.idCheckLists AND resp.Respmission.idMission = :idmiss AND eq.idEquipements = :idEqp ")
public List<ResponsesCheckLists> ListCheckListsNonRepondu(@Param("idEqp") long idEqp, @Param("idmiss") long idmiss);
錯誤EDIT2的:
所致:java.lang.IllegalStateException:對於節點沒有任何數據類型: org.hibernate.hql .internal.ast.tree.IdentNode + - [IDENT] IdentNode: 'check'{originalText = check} antlr.SemanticExcept離子:加入的路徑!
如何更正此查詢?
預先感謝您
你想要做一個本地查詢或JPQL查詢嗎? –
我想做JPQL – Michael1
中的查詢在WHERE子句中不允許使用'LEFT JOIN'。 – ujulu