Hql Fetch: Condition on the right table

891 views Asked by At

1st question on StackOverflow !

In HQL I try to execute the following query :

    FROM Device d
    LEFT JOIN FETCH d.listNotifications l
    WITH l.dateLastSending BETWEEN :startDate AND :endDate"
    WHERE d.registerId=:registerId";

But getting following the error : "with-clause not allowed on fetched associations; use filters"

Filters looks a little bit complicated to me.

Is there any issue to set a condition on the right table ?

Regards

1

There are 1 answers

3
Luca Basso Ricci On BEST ANSWER

Remove FETCH clause.

(or try

FROM Device d
LEFT JOIN FETCH d.listNotifications l
WHERE (l.dateLastSending BETWEEN :startDate AND :endDate) AND (d.registerId=:registerId)

)