Reputation: 1
<query name="getStudyTasksByParticipantId">
from StudyTask st
join (select max(lastUpdatedDate)as lastUpdatedDate, study, clinicalStudyRegistration from
StudyTask where clinicalStudyRegistration.participant.id in (:participantIds)
group by study, clinicalStudyRegistration ) lst
where st.lastUpdatedDate = lst.lastUpdatedDate
order by st.lastUpdatedDate desc
</query>
When I run this query, it gives error like unexpected token: ( at line 3 col 30
.
What's wrong in this query
Upvotes: 0
Views: 83
Reputation: 692121
The query is not valid HQL. The documentation says:
Note that HQL subqueries can occur only in the select or where clauses.
A join can only be done through an association between two entities.
Upvotes: 1