title: How to use the setParameterList() method in Hibernate?
body: <p>I have a requirement to fetch selected rows from Oracle database based on <code>ids</code> supplied as an array, something like the <code>SELECT ... FROM table_name WHERE id IN()</code> query. </p>
  
  <p>In my attempts to do so, I'm trying to use the <a href="https://docs.jboss.org/hibernate/orm/5.1/javadocs/org/hibernate/Query.html#setParameterList-java.lang.String-java.lang.Object:A-" rel="noreferrer"><code>org.hibernate.setParameterList(String name, Object[] values)</code></a> method in my DAO as follows.</p>
  
  <pre><code>@Service
  @Transactional(readOnly = true, propagation=Propagation.REQUIRES_NEW)
  public final class ProductImageDAO implements ProductImageService {
  
      @SuppressWarnings("unchecked")
      public List&lt;Object[]&gt; getFileName(String[] list) {
          return sessionFactory
                  .getCurrentSession()
                  .createQuery("SELECT prodImageId, prodImage FROM ProductImage WHERE prodImageId=:list")
                  .setParameterList("list", list).list();
      }
  }
  </code></pre>
  
  <p>The parameter of type <code>String[]</code> in the given method is supplied from the respective Spring controller class.</p>
  
  <p>It causes the following exception to be thrown.</p>
  
  <blockquote>
    <p>org.hibernate.hql.ast.QuerySyntaxException: unexpected token: , near
    line 1, column 78 [select prodImageId, prodImage from
    model.ProductImage where prodImageId=:id0_, :id1_, :id2_, :id3_,
    :id4_, :id5_]</p>
  </blockquote>
  
  <p>What is the way to retrieve the selected rows based on list of <code>ids</code> using Hibernate?</p>