title: hibernate total criterions in a junction
body: <p>I fill a junction based on conditions coming from a filter:</p>
  
  <pre><code>if (filter.getName() != null) conjunction.add(...);
  if (filter.getSurname() != null) conjunction.add(...);
  </code></pre>
  
  <p>At the end add the junction to my Criteria:</p>
  
  <pre><code>criteria.add(conjunction);
  </code></pre>
  
  <p>I would like to apply certain aliases to my criteria object only if the total number of criterions in the conjunction are > 0 (to optimize the query):</p>
  
  <pre><code>if (moreThanOneCriterion(conjunction)) {
      criteria.createCriteria("users", "user");
      criteria.add(conjunction); 
  }
  </code></pre>
  
  <p>How can I know the total number of criterions in a junction ?</p>
  
  <p>As an option, could add a counter variable inside each if block, but looking for a better/cleaner option.</p>