Minor trouble with error checking in jpql queries

I have an orm.xml file in a JPA project. The code fragment below demonstrates the problem...

<named-query name="getRequestListForMRI">
        <query>
            SELECT ar
            FROM AuthorizationRequest AS ar
                JOIN ar.moratoriumRight mri
                JOIN mri.validFishingMoratorium laf
                JOIN FETCH ar.validQualifyingLevel
                JOIN FETCH ar.status
                JOIN FETCH ar.vesselPermitNum
            WHERE laf.moratoriumName = :moratoriumName
                AND ar.authorizationRequestPK.requestDate BETWEEN :startDate AND :endDate
                AND mri.mri = :mri
        </query>
    </named-query>

The editor report errors on the line "JOIN mri.validfishingMoratorium laf" and
the final line "AND mri.mri" complaining it can't resolve the expressions
mri.validFishingMoratorium and mri.mri. The error is reproducible. If I reference
a nested association (third level) or deeper from the root object
returned in the select clause, Intellij can't
resolve it and reports the error.

Grant

Please sign in to leave a comment.