title: Hibernate conditionally subCriteria
body: <p>i need to convert this HQL:</p>
  
  <pre><code>FROM Appointment a WHERE (a.group==null OR :user MEMBER OF a.group.groupMembers) 
  </code></pre>
  
  <p>to criteria. How can i archieve that a subcriteria is only used when a maincriteria is not matching?</p>
  
  <p>i tried something like that, but i'm stuck:</p>
  
  <pre><code>Criteria subcrit = crit.createCriteria("group");
  subcrit.createAlias("groupMembers", "gmembers");
  crit.add(Restrictions.or(Restrictions.eq("group", null), Restrictions.eq("gmembers.snuserId", user.getId())));
  </code></pre>