title: Nhibernate DetachedCriteria Left Outer Join on subquery
body: <p>I'll only try to present the main part of the problem, because the whole situation is much more complicated - I am unable to achieve the following with DetachedCriteria</p>
  
  <pre><code>SELECT *
  FROM User
  LEFT OUTER JOIN GroupItem
  ON User.ID = GroupItem.UserID
  AND _groupItemRestrictions_
  </code></pre>
  
  <p>There can be multiple GroupDefinitions, User can belong to multiple GroupItems which each belong to it's own GroupDefinition. Due to some complicated reason with paging/sorting and (multilevel) group behavior, I cannot achieve appropriate paging behavior with this query:</p>
  
  <pre><code>SELECT *
  FROM User
  LEFT OUTER JOIN GroupItem
  ON User.ID = GroupItem.UserID
  WHERE _groupItemRestrictions_
  </code></pre>
  
  <p>A query similar to the second one is produced this way:</p>
  
  <pre><code>var criteria = DetachedCriteria.For&lt;User&gt;()
  ...
  GroupItem groupItem = null;
  criteria.CreateAlias(() =&gt; groupItemAlias, () =&gt; groupItem,
                                                  JoinType.LeftOuterJoin);
  criteria.Add(Restrictions.Or(...));
  ...
  </code></pre>
  
  <p>Is it possible to create the first query with DetachedCriteria?</p>
  
  <p>Thanks!</p>