title: Is it possible to pass and test for an empty list in JPA?
body: <p>I have a JPQL named query that takes a <code>List</code> as a parameter.  I'm using the parameter in an <code>IN</code> phrase:</p>
  
  <pre><code>...WHERE x.id IN :list
  </code></pre>
  
  <p>I'd like to do something like the following but the syntax apparently won't let me:</p>
  
  <pre><code>...WHERE :list IS EMPTY OR x.id IN :list
  </code></pre>
  
  <p>Neither will:</p>
  
  <pre><code>...WHERE SIZE(:list) = 0 OR x.id IN :list
  </code></pre>
  
  <p>Is what I'm trying to do impossible in a JPA 2.0 named query?  I know how to do it via the criteria API or using plain old JPQL strings.</p>