0

I am receiving

org.hibernate.hql.internal.ast.QuerySyntaxException: Path expected for join!

Error in JPA Spring boot kindly let me know what is the issue in following query

 select q.label, 
 q.id, q.parentId, 
 c.id , c.createdOn,
 c.logAnswerVisualData, 
 c.logAnswerValue, 
 a.label, 
 a.typeId, 
 a.visualTypeId, 
 vt.label, 
(SELECT Count(pq.id) FROM Pinnedquestion pq WHERE 
pq.questionId = q.id  AND pq.userId =:userId), 
(SELECT Count(fq.id) FROM Favoritequestion fq WHERE 
fq.questionId = q.id  AND fq.userId =:userId), 
at.label FROM Question q JOIN Conversation c ON q.id = 
c.questionId JOIN Answer a ON  a.id = q.answerId JOIN AnswerType at ON  
at.id = a.typeId LEFT JOIN VisualizationType vt ON vt.id = a.visualTypeId 
WHERE  c.userId =:userId AND c.id=:convId ORDER BY c.serverTimestamp desc
Khalid Habib
  • 1,100
  • 1
  • 16
  • 25
  • 1
    I assume You are talking abot Spring Data JPA used in Spring Boot. This query is created by hand or is the result of criteria query or Spring Data DSL? – Chlebik Oct 19 '18 at 08:42
  • 2
    Possible duplicate of [HQL ERROR: Path expected for join](https://stackoverflow.com/questions/10448935/hql-error-path-expected-for-join) – Patrick Oct 19 '18 at 08:43
  • 1
    JPQL syntax is shown in many docs on the web. You seem to be attempting to join to some unrelated entity whereas you should join through relations. So you resolve it by doing just that (or looking at documentation ...) –  Oct 19 '18 at 09:06
  • do you guys have any example code in which I can see a proper solution – Khalid Habib Oct 19 '18 at 09:45
  • 1
    How can anyone give "an example" when you don't post your entities and show the relations? There are lots of JPQL docs on the web –  Oct 19 '18 at 17:03

0 Answers0