I’m in process of upgrading from spring boot 2.x to 3.x. I encountered an issue with one of my JPQL query that I guess relates to type matching introduced in hibernate 6.x
In my entity I have a LocalDateTime field which in my query (JPQL) I compare against ‘9999-12-31 23:59:00’
@Modifying
@Query("UPDATE DetailsEntity wt SET wt.updateBy = :user, wt.endDate = :endDate WHERE wt.type = :type AND wt.bankwideForecast = :scenario AND wt.endDate = '9999-12-31 23:59:00'")
void updateUpdatedByAndEndDate(@Param("user") String user, @Param("endDate") LocalDateTime endDate, @Param("type") RecordType type, @Param("scenario") String scenario);
After migration, I’m getting below error:
Caused by: org.hibernate.query.SemanticException: Cannot compare left expression of type 'java.time.LocalDateTime' with right expression of type 'java.lang.String'
I have gone through https://discourse.hibernate.org/t/upgrade-to-6-3-rc1-cannot-compare-left-expression-of-type-java-sql-timestamp-with-right-expression-of-type-com-model-entity-impl-user/8034/5 and other similar posts like- Spring boot 2 to spring boot 3 Migration issue and Validation failed for query for method upgrading from Spring Boot 3.1.5 to 3.2.0 but not sure how to fix this.
How do I get around this?