title: Nhibernate many to many criteria query with subselect
body: <p>I have a simple example of a blog: a Post table, a Tag table and a Post_Tag_MM lookup table linking the two tables. </p>
  
  <p>I use this hql query in order to fetch all posts, that DONT have some tags:</p>
  
  <pre><code>            var result = session
                              .CreateQuery(@"
                                  select p from Post p 
                                  join p.Tags t 
                                  where (select count(ti) from p.Tags ti where ti.Uid in (:uidList)) = 0
                              ")
                              .SetParameterList("uidList", uidList)
                              .SetResultTransformer(new DistinctRootEntityResultTransformer())
                              .List&lt;Post&gt;();
  </code></pre>
  
  <p>How can this many-to-many query and the subselect translated into a criteria query?</p>
  
  <p>I dont quite understand the DetachedCriteria API yet and could not get it to return the right resultset.</p>
  
  <p>Thank you very much in advance.</p>
  
  <p>Regards,</p>
  
  <p>Max</p>