title: JPA 2.0, Criteria API, Subqueries, In Expressions
body: <p>I have tried to write a query statement with a subquery and an <code>IN</code> expression for many times. But I have never succeeded.</p>
  
  <p>I always get the exception, " Syntax error near keyword 'IN' ", the query statement was build like this,</p>
  
  <pre><code>SELECT t0.ID, t0.NAME
  FROM EMPLOYEE t0
  WHERE IN (SELECT ?
            FROM PROJECT t2, EMPLOYEE t1
            WHERE ((t2.NAME = ?) AND (t1.ID = t2.project)))
  </code></pre>
  
  <p>I know the word before 'IN' lose.</p>
  
  <p>Have you ever written such a query? Any suggestion?</p>