user1484857
user1484857

Reputation: 1

Hibernate query error

<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

Answers (1)

JB Nizet
JB Nizet

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

Related Questions