| I discovered something that works for me, see below, I changed the JPQL query to use named parameters instead of ?1, ?2, ?3, ?4, hope this helps someone else:
@Query("select count(c) from GenericShipment c where (c.processingStatus is null or c.processingStatus <> 'DELETED') AND (c.client.id = :clientId) and (c.createdDate between :startDate and :endDate) and (:sendType is null or c.sendType = :sendType) ")
Long countByClientIdAndCreatedDateBetween(String clientId, Date startDate, Date endDate, SendTypeEnum sendType);
Tested this with the version Spring Data JPA 2.1.7.RELEASE (it is a Spring Boot 2.1.7.RELEASE app), same Postgre version (9.6.12). |