title: Criteria with "in" operator and empty list
body: <p>I have next problem.</p>
  
  <p>I have next criteria:</p>
  
  <pre><code>criteria.add(Restrictions.in("entity.otherEntity", getOtherEntitiesList()));
  </code></pre>
  
  <p>if my otherEntitiesList is empty. Hibernate generate next query:</p>
  
  <pre><code>select count(*) as y0_ 
  from OTHER_ENTITY this_ 
  where this_.OTHER_ENTITY_ID in ( ) 
  </code></pre>
  
  <p>and i get exception from Oracle.</p>
  
  <p>I found next line in Hibernate code:</p>
  
  <pre><code> String params = values.length &gt; 0 ? StringHelper.repeat(
                  singleValueParam + ", ", values.length - 1 )
                  + singleValueParam : "";
  </code></pre>
  
  <p>It's not possible use this method to generate criteria.
  I need a way to generate Hibernate criteria with empty list. If list is empty I want to get empty answer. </p>
  
  <p>Is it possible?</p>
  
  <p>Thanks</p>