title: Find all items which contain certain set elements with JPA QL
body: <p>I have an <code>Item</code> class which contains a <code>Set</code> of <code>Tag</code> objects. Now I want to find all Items which contain <em>all</em> the required the tags with JPA (based on Hibernate 4.1.9).</p>
  
  <p>My repository methods gets a java.util.Set and the body of this method looks like this:</p>
  
  <pre><code>entityManager.createQuery("select item from Item as item where item.tags in :tags")
  .setParameter("tags", tags)
  .getResultList()
  </code></pre>
  
  <p>It looks like this <a href="https://stackoverflow.com/a/4644668/238134">solution</a> to me, but all I get is the error message:</p>
  
  <blockquote>
    <p>IllegalArgumentException: org.hibernate.hql.internal.ast.QuerySyntaxException: unexpected end of subtree [select item from models.Item as item where item.tags in ()]</p>
  </blockquote>
  
  <p>If I turn the condition around</p>
  
  <pre><code>"select item from Item as item where :tags in item.tags"
  </code></pre>
  
  <p>what I think would be correct (instead of the above query), I get a <code>NullPointerException</code> in the last line (<code>getResultList()</code>).</p>
  
  <p>What is wrong?</p>