Joining to the projects of departments is necessary, because single project is later on needed in WHERE clause:
p.location = :location
Projects is a collection. Consequently e.projects
is collection valued path expression. It is not possible navigate through collection valued path expression. Following construct is not expected to work, because collection does not have location
property.
e.projects.location = :location