title: Spring Boot JPA: Passing Multiple Values for the Same Parameter (JPQL)
body: <p>I'm using JPQL to write SQL queries in JPA's <code>CurdRepository</code> interface. I was able to write more than one query with named parameters and they work like a charm. </p>
  
  <p>However, my application requires that I match an unknown number of strings with more than one column in a table. To my knowledge, in SQL it'd look something like this:</p>
  
  <pre><code>SELECT * FROM TABLE WHERE COLUMN_1 LIKE "%string_1%" OR COLUMN_1 LIKE"%string_2%" ... OR COLUMN_2 LIKE "%string_1%" OR COLUMN_2 LIKE "%string_2%" ... ...
  </code></pre>
  
  <p>I tried this in MySQL and it works fine. I couldn't figure out how to depict this in JPQL, however. I was able to pass multiple values for the <code>IN</code> clause by setting the named parameter to a <code>List</code>, as follows:</p>
  
  <pre><code> @Query("SELECT t FROM Table t WHERE TABLE_ID IN (:table_ids)")
  public Page&lt;Table&gt; findByParameters(@Param("table_ids") List&lt;Integer&gt; table_ids, Pageable page)
  </code></pre>
  
  <p>I tried doing the same thing with the <code>LIKE</code> clause but I end up with 0 results if I pass more than 1 value. I face the same problem with the <code>LOCATE</code> clause as well. </p>
  
  <p>Worst case scenario, I can set up one query that works on one String, and call it several times and then merge all the results. I'd very much rather avoid this however, as it'd be nothing more than a duct-tape solution.</p>
  
  <p>I looked online for solutions for hours but haven't found anything that addresses my concern. Any tip is highly appreciated.</p>
  
  <p>Thanks.</p>