title: How to generate a predicate array of OR statements
body: <p>I am trying to use the Criteria API instead of constructing queries as JPQL Strings as the Criteria API seems much better suited for this. However, I am having a few problems understanding how to construct the two following statements.</p>
  
  <pre><code>SELECT e 
  FROM Subject e 
  WHERE e.company = :c1 
  OR e.company = :c2 
  OR e.company = :c3
  </code></pre>
  
  <p>In this case I need to iterate over an unknown number of values (c1, c2, c3 etc.) to match to the same attribute. </p>
  
  <pre><code>SELECT e 
  FROM Subject e 
  WHERE e.company 
  LIKE :c1 
  OR e.account 
  LIKE :c1 
  OR e.email 
  LIKE :c1
  </code></pre>
  
  <p>In this case I need to pass in a single value (c1) and have a 'LIKE' comparison done on a specific range of attributes.</p>
  
  <p>My current pattern looks something like this:</p>
  
  <pre><code>// Criteria
  CriteriaBuilder builder = subjectDAO.criteriaBuilder();
  CriteriaQuery&lt;Subject&gt; query = builder.createQuery(Subject.class);
  
  // Root
  Root&lt;Subject&gt; subject = query.from(Subject.class);
  
  List&lt;Predicate&gt; predicates = new ArrayList();
  
  for (String property : map.keySet()) {
      String value = (String) coreFilter.get(map);
      predicates.add(????? This is where I come unstuck ?????);
  }
  
  // pass all the predicates into the query
  query.where(predicates.toArray(new Predicate[predicates.size()]));
  </code></pre>
  
  <p>NB. I don't have any problems constructing the Query object or specifying the Root or Joins. I am just having problems with the specificity of the above queries. For the sake of clarity just assume that all the attributes are String and don't require any joins.</p>