What is the JPQL/JPA/Hibernate equivalent of 'date_trunc('day', (entity.date AT TIME ZONE 'UTC'))'


#1

I also posted this question at https://stackoverflow.com/questions/53499478/what-is-the-jpql-jpa-hibernate-equivalent-of-date-truncday-entity-date-at

What is the JPQL/JPA/Hibernate equivalent of the database function date_trunc('day', (entity.date AT TIME ZONE 'UTC')) ?

I need to be rounding down to full days (and weeks, etc.) in a Spring Boot application with Hibernate running on top of a Postgresql database. This query is possible in native postgresql but I haven’t figured out how to do it in Hibernate yet. The timezone may vary so I can’t just set it to a default.

I found an ancient post at the (old) Hibernate forums without any replies: https://forum.hibernate.org/viewtopic.php?f=1&t=990451


#2