title: Postgres Sql `could not determine data type of parameter` by Hibernate
body: <p>I have <strong>JpaRepository</strong>:</p>
  
  <pre><code>@Repository
  public interface CardReaderRepository extends JpaRepository&lt;CardReaderEntity, Integer &gt; {
  
  
  }
  </code></pre>
  
  <p>when i execute query in this repo same as this:</p>
  
  <pre><code>@Query(
      value = "SELECT new ir.server.component.panel.response." +
              "InvalidCardReaderDataDigestResponse(" +
              "    cr.driverNumber, cr.exploiterCode, cr.lineCode, " +
              "    cr.transactionDate, cr.offLoadingDate, " +
              "    cr.cardReaderNumber, " +
              "    sum(cr.count) , sum(cr.remind) " +
              ") " +
              "FROM CardReaderEntity cr " +
              "WHERE cr.company.id = :companyId " +
              "AND cr.status.id in :statusIds " +
              "AND cr.deleted = false " +
              "AND  (:fromDate is null or cr.offLoadingDate &gt;= :fromDate ) " +
              "AND  (:toDate   is null or cr.offLoadingDate &lt;= :toDate   ) " +
              "group by cr.driverNumber, cr.exploiterCode, cr.lineCode, cr.transactionDate, cr.offLoadingDate, cr.cardReaderNumber"
  )
  Page&lt;InvalidCardReaderDataDigestResponse&gt; findAllInvalidCardReaderDataDigestByCompanyIdAndStatusIdIn(
          @Param( "companyId" )   int companyId,
          @Param( "fromDate" )    Date fromDate,
          @Param( "toDate" )      Date toDate,
          @Param( "statusIds" )   List&lt;Integer&gt; statusIds,
          Pageable pageable
  );
  </code></pre>
  
  <p>error is :</p>
  
  <pre><code>org.postgresql.util.PSQLException: ERROR: could not determine data type of parameter $3
      at org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:2433) ~[postgresql-42.2.2.jar:42.2.2]
      at org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:2178) ~[postgresql-42.2.2.jar:42.2.2]
      at org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:306) ~[postgresql-42.2.2.jar:42.2.2]
  </code></pre>
  
  <p>but when a change query to:</p>
  
  <pre><code>@Query(
      value = "SELECT new ir.server.component.panel.response." +
              "InvalidCardReaderDataDigestResponse(" +
              "    cr.driverNumber, cr.exploiterCode, cr.lineCode, " +
              "    cr.transactionDate, cr.offLoadingDate, " +
              "    cr.cardReaderNumber, " +
              "    sum(cr.count) , sum(cr.remind) " +
              ") " +
              "FROM CardReaderEntity cr " +
              "WHERE cr.company.id = :companyId " +
              "AND cr.status.id in :statusIds " +
              "AND cr.deleted = false " +
              "AND  (:fromDate is null ) " +
              "AND  (:toDate   is null ) " +
              "group by cr.driverNumber, cr.exploiterCode, cr.lineCode, cr.transactionDate, cr.offLoadingDate, cr.cardReaderNumber"
  )
  Page&lt;InvalidCardReaderDataDigestResponse&gt; findAllInvalidCardReaderDataDigestByCompanyIdAndStatusIdIn(
          @Param( "companyId" )   int companyId,
          @Param( "fromDate" )    Date fromDate,
          @Param( "toDate" )      Date toDate,
          @Param( "statusIds" )   List&lt;Integer&gt; statusIds,
          Pageable pageable
  );
  </code></pre>
  
  <p>this work without error but a want run with <strong>fromDate</strong> and <strong>toDate</strong></p>
  
  <p>note:</p>
  
  <p><strong>offLoadingDate</strong> in <strong>CardReaderEntity</strong>:</p>
  
  <pre><code>@Basic
  @Temporal( TemporalType.TIMESTAMP )
  public Date getOffLoadingDate() {
      return offLoadingDate;
  }
  public void setOffLoadingDate(Date offLoadingDate) {
      this.offLoadingDate = offLoadingDate;
  }
  </code></pre>
  
  <p>all of Date import in my java files is <strong>java.util.Date</strong>.</p>