title: Hibernate primitive collection contains value
body: <p>Given a hibernate mapping like this:</p>
  
  <pre><code>&lt;class name="TestData" table="test_data"&gt;
      &lt;id name="integer" column="id_column"/&gt;
      &lt;bag name="integers" table="test_data_collection"&gt;
          &lt;key column="id_column"/&gt;
          &lt;element column="value" type="integer"/&gt;
      &lt;/bag&gt;
  &lt;/class&gt;
  </code></pre>
  
  <p>How can I create a Criteria that will create SQL something like this:</p>
  
  <pre><code>SELECT * FROM test_data WHERE 100 in (SELECT value FROM test_data_collection WHERE test_data_collection.id_column=test_data.id_column)
  </code></pre>
  
  <p>The goal being to get all TestData objects which have 100 in their 'integers' list. Ideally, I'd like to do the reverse too: all TestData objects which <em>don't</em> have 100 in their 'integers' list.</p>
  
  <p>Most searching online showed examples of this when the bag contains objects, but I can't figure out how to do it for primitive collections.</p>