Skip to content
Advertisement

How to obtain CURDATE() / NOW() on a JPA named query?

I want to do a select from table where date = TODAY, on mysql that would be where date > CURDATE(), how do I do this on a JPA named query?

Advertisement

Answer

That depends on your JPA provider. Hibernate, for example, supports current_date function:

from MyEntity where myDateProperty > current_date
Advertisement