DATEDIFF in JPQL Query

Hi,

Can how can we use below sql format in JPQL to find the last 7 days of user.
7 is dynamic variable it can be any no of days data that can be fetch.

DATEDIFF(DAY, C.DATE_TIME, CURRENT_TIMESTAMP) <= 7

Hello,

No, but you can use jpql functions:

Also you can use EntityManager or JdbcTemplate.

EntityManager:

JdbcTemplate:

Regards,
Nikita

1 Like