title: Hibernate restriction in causes an error if the list is empty
body: <p>If my list is empty, I get the following error:</p>
  
  <pre><code>You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ')'
  </code></pre>
  
  <p>Below is my hibernate related method:</p>
  
  <pre><code>  @Override
      public List&lt;SomeThing&gt; findByIds(List&lt;Integer&gt; someIds) {
          return sessionFactory.getCurrentSession().createCriteria(SomeClass.class)
                  .add(Restrictions.in("id", someIds))
                  .list();
      }
  </code></pre>
  
  <p>What should I do to guard against this error?</p>
  
  <p>I know I could short-circuit the call and return an empty list like:</p>
  
  <pre><code>if(someIds == null || someIds.size() == 0) {
    return new List&lt;SomeThing&gt;();
  }
  </code></pre>
  
  <p>But is there a more elegant way to do this?</p>