Migration to SpringBoot 3: trunc a date with oracle driver no longer works (hibernate)

I am currently migrating a SpringBoot 2.7 application to SpringBoot 3. The following query is used within a SpringData repository:


@Query("select b from #{#entityName} b where (trunc(b.date) <= trunc(:date))")
List<T> findByDate(LocalDateTime date);

While this works great in SpringBoot 2.7, with SpringBoot 3 the following message is thrown:

org.hibernate.QueryException: Parameter 1 of function trunc() has type NUMERIC, but argument is of type java.time.LocalDateTime

Unfortunately, a simple migration to datetrunc was unsuccessful:

Error Msg = ORA-00904: “DATETRUNC”: ungültige ID

Does anyone have a solution for this?

Best regards

Hey there. It seems that the trunc function has multiple overloads but Hibernate 6 only supports the numeric variant right now. Please create a JIRA issue for this bug.

Thank you for your prompt reply. Issue was opened under HHH-15855.

1 Like

we have recently updated our application from Spring boot 2.x to 3.x . We are facing issue with Trunc a date .
Could you please provide update on ticket which you have created on DEC 2022

Hibernate is an open source project, so you can contribute a fix for this or pay someone to do so for you if this matter is so important to you. If you don’t want that, then you’ll simply have to wait until the Hibernate team has the time to fix this.