Below query
Join<Object, QualityProject> project = cb.treat(emp.join("projects"), QualityProject.class); cq.select(emp) .where(cb.gt(project.<Integer>get("qualityRating"), 5));
causes
Unable to locate Attribute with the the given name [qualityRating] on this ManagedType [org.projpa2.chapter9.model.Project]
Attached the test project