title: JPQL - if parameter is null, then all
body: <p>Is there a possibility in JPQL to return all results and ignore the null value in parameter instead of looking for null values?</p>
  
  <p>For example:</p>
  
  <pre><code>@Query("SELECT p FROM PromoCode p " +
              "WHERE (LOWER(p.name) LIKE LOWER(concat('%', concat(:query, '%'))) OR " +
              "LOWER(p.promoCode) LIKE LOWER(concat('%', concat(:query, '%')))) AND p.type = :type")
  Page&lt;PromoCode&gt; search(@Param("query") String query, @Param("type") PromoCode.Type type, Pageable pageable)
  </code></pre>
  
  <p>How do I ignore <code>:type</code>, if it's null?</p>