Is there a way to put a date range condition referencing the current time in a JPA query (that is compatible across databases)?
I can do
SELECT m FROM Mail m WHERE m.sentAt < :date
but I want to do it without having to bind a parameter (so that this can be configured as part of the named query repository and the date calculation logic does not have to enter the calling code).
So instead of :date
I need "currentTime minus 3 minutes" as a hard-code literal.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…