Postgresql with Hibernate: could not determine LocalDate type in jpql query Postgresql with Hibernate: could not determine LocalDate type in jpql query postgresql postgresql

Postgresql with Hibernate: could not determine LocalDate type in jpql query


I had the same problem with JPA and LocalDate parameters.

The solution is to cast the value before the IS NULL comparison.

In your example:

@Query("SELECT t FROM TransactionHistory t WHERE (t.account.id=:account)"    + " AND ( CAST(:dateFrom AS date) IS NULL OR t.date >= :dateFrom)"    + " AND ( CAST(:dateTo AS date) IS NULL OR t.date <= :dateTo)"    + " order by t.date asc")List<TransactionHistory> findByAccountIdAndDate(    @Param("account") Long id,    @Param("dateFrom") LocalDate from,    @Param("dateTo") LocalDate to);


try to add

@Convert(converter = LocalDateConverter.class)

Example:

@Column  @Convert(converter = LocalDateConverter.class)  private LocalDate valueDate;

Hope this will help you.