As you can see in this question JPA 2.0, Criteria API, Subqueries, In Expressions, there is a method for subqueries with Criteria API:
SELECT e
FROM Employee e
WHERE e IN (SELECT emp
FROM Project p JOIN p.employees emp
WHERE p.name = :project)
But how about simply query like this:
SELECT e
FROM Employee e
WHERE e.project.name = :project
Which one is faster and why?