title: Optional param in a JPQL Query causing issues with Instant Class
body: <p>I need to create a query capable to be executed even if you send a null values in its params, the params are Instant with default format ISO-8601, the query works without any param, but if I send the param it stops working. Any suggestions? </p>
  
  <p><strong>CODE:</strong></p>
  
  <pre><code>@Query(value = "SELECT re " 
          + "FROM report re "
          + "WHERE ( "
          + "( re.date BETWEEN :dateFrom AND :dateTo) OR (:dateFrom IS NULL OR :dateTo IS NULL))"
  List&lt;Report&gt; reportByDate(@Param("dateFrom") Instant dateFrom,
          @Param("dateTo") Instant dateTo)
  </code></pre>
  
  <p><strong>Error:</strong></p>
  
  <blockquote>
    <p>Exception [EclipseLink-4002] (Eclipse Persistence Services - 2.6.4.v20160829-44060b6): org.eclipse.persistence.exceptions.DatabaseException
    Internal Exception: org.h2.jdbc.JdbcSQLException: 
    Syntax error in SQL statement "SELECT DISTINCT T1.COL_1, T1.COL_2, T1.COL_3
    FROM REPORT T1
    WHERE ((T0.DATE BETWEEN TS '2000-03-07 17:01:01.0' AND TS '2030-03-07 17:01:01.0') OR ((2030-03-08T01[*]:01:01Z IS NULL) AND (2000-03-08T01:01:01Z IS NULL)))"; 
    expected "[, ::, *, /, %, +, -, ||, ~, !~, NOT, LIKE, ILIKE, REGEXP, IS, IN, BETWEEN, AND, OR, ,, )"; SQL statement:            </p>
  </blockquote>