hibernatehqlfetching-strategy

Hql Fetch: Condition on the right table


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


Solution

  • 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)
    

    )