Quantcast
Viewing all articles
Browse latest Browse all 2

Answer by Eugene for How to get Date Difference in hour using HQL

  1. HQL supports EXTRACT(... FROM ...) function, and EPOCH keyword although it is not mentioned in documentstion.
  2. HQL also supports no-argument LOCALTIMESTAMP function (for Postgres and MySQL dialects). This fact also is not in documentation, but I found it in sources (link1, link2)

So, required HQL query is:

FROM SomeEntity p WHERE EXTRACT(EPOCH FROM (LOCALTIMESTAMP-p.storageTime))/3600 > :threshold

Viewing all articles
Browse latest Browse all 2

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>