title: Criteria in NHibernate for "not in" or "not exists"
body: <p>I am trying to create criteria in  NHibernate for the following statement:</p>
  
  <pre><code>SELECT *
    FROM InventoryItems
    where id not in (select inventory_id from InventoryItemCategories where Category_Id = 'EB0DA6DE-DC18-4306-9EF7-E506463555A9')
  </code></pre>
  
  <p>or i assume that this one is even better</p>
  
  <pre><code>SELECT *
    FROM InventoryItems
    where id not exists (select inventory_id from InventoryItemCategories where Category_Id = 'EB0DA6DE-DC18-4306-9EF7-E506463555A9')
  </code></pre>
  
  <p>I have tried this but it does not work:</p>
  
  <pre><code> var criteria = Session.CreateCriteria&lt;InventoryItem&gt;()
        .Add(Subqueries.WhereNotExists(("id"), DetachedCriteria.For&lt;InventoryItemCategories&gt;()
         .Add(Restrictions.Eq("Category_id",inventoryCategoryId))));
  </code></pre>
  
  <p>Thanks a lot for the help</p>