title: "or" predicate inside "and" predicate using JPQL
body: <p>i want to do a select query using JPQL but i have a mistake on my code,
  here's the code</p>
  
  <pre><code>private CriteriaQuery&lt;TbCase&gt; getQueryParams(TbCaseSearchParams params, CriteriaBuilder cb, CriteriaQuery&lt;TbCase&gt; cq,Root&lt;TbCase&gt; root){
  
      List&lt;Predicate&gt; criteria = new ArrayList&lt;Predicate&gt;();
  
      if(params.getEqColumns() != null &amp;&amp; params.getEqValues() != null){
          criteria = getEqParamsCriteria(criteria, cb, root, params.getEqColumns(), params.getEqValues());
      }else if(params.getLikeColumns() != null &amp;&amp; params.getLikeValues() != null){
          criteria = getLikeParamsCriteria(criteria, cb, root, params.getLikeColumns(), params.getLikeValues());
      }else{  
  
          if(params.getCaseNumber() != null){
              criteria.add(cb.equal(root.get("caseNumber"), params.getCaseNumber()));
          }
  
          if(params.getCaseStatusIds() != null){
              List&lt;String&gt; caseStatusIds = new ArrayList&lt;String&gt;();
              caseStatusIds = params.getCaseStatusIds();
              for(int i=0 ; i&lt;caseStatusIds.size() ; i++){
                  criteria.add(cb.or(cb.equal(root.get("caseStatusByCaseStatusId"), Integer.valueOf(params.getCaseStatusIds().get(i)))));
              }
          }
      }
  
      cq.select(root).where(cb.and(criteria.toArray(new Predicate[0])));
  
      return cq;
  }
  </code></pre>
  
  <p>this is the query result in SQL form</p>
  
  <pre><code>select something from TABLENAME as something where ( something.caseNumber=:param0 ) and ( something.caseStatusByCaseStatusId=1 ) and ( something.caseStatusByCaseStatusId=-1 ) and ( something.caseStatusByCaseStatusId=1 ) and ( something.caseStatusByCaseStatusId=9 ) and ( something.caseStatusByCaseStatusId=4 ) and ( something.caseStatusByCaseStatusId=5 ) and ( something.caseStatusByCaseStatusId=10 ) and ( something.caseStatusByCaseStatusId=2 ) order by something.caseNumber desc
  </code></pre>
  
  <p>and the expected query is like this</p>
  
  <pre><code>select something from TABLENAME as something where ( something.caseNumber=:param0 ) and ( something.caseStatusByCaseStatusId=1 or something.caseStatusByCaseStatusId=-1 or something.caseStatusByCaseStatusId=1 or something.caseStatusByCaseStatusId=9 or something.caseStatusByCaseStatusId=4 or something.caseStatusByCaseStatusId=5 or something.caseStatusByCaseStatusId=10 or something.caseStatusByCaseStatusId=2 ) order by something.someCriteria desc
  </code></pre>
  
  <p>what to do with my code to have the expected query result?, if you need another detail, i will update immediately thx.</p>