title: jpql IN query with enum value
body: <p>I am using JPQL query to check whether the list contains the specified enum values. If the enum value is a single element to check then it is pretty simple.</p>
  
  <p>In query expression,</p>
  
  <pre><code>query = "... where s.status = :status";
  </code></pre>
  
  <p>and then set parameter like</p>
  
  <pre><code>query.setParameter("status", statusValue);
  </code></pre>
  
  <p><strong>But I want to check something like below</strong></p>
  
  <pre><code>query = "... where s.status IN (:statusList)";
  </code></pre>
  
  <p>where <code>statusList</code> is a string of numbers (e.g. "0,1,2" which means the list of the values of status)</p>
  
  <p>But I can't find a solution. I have also checked with <code>s.status.ordinal() IN (statusList)</code> in query but no luck.</p>
  
  <p>I'm using JPA Implementation: EclipseLink (JPA 2.0)</p>
  
  <p>My Entity's actual name is <code>SType</code></p>
  
  <pre><code>public enum SType
  {
      REQUISITION,
      PURCHASE,   
      FINISHED,   
      // others
      RETURN;
  }
  </code></pre>
  
  <p><strong>QUERY:</strong></p>
  
  <pre><code>String querySt = "select s.slipType.slipNameSt,s.slipNumberSt, s.idNr from Slip s 
  where s.slipType.sType IN (:enumTypeListt)";
  
  em.createQuery(querySt).setParameter("enumTypeList", EnumSet.of(SType.REQUISITION, 
                                                                  SType.PURCHASE));
  </code></pre>