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

Tags: , ,



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?

Answer

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

from MyEntity where myDateProperty > current_date


Source: stackoverflow