I want to check weather validTill date is greater than today using JPQL. I know that I can achieve this by following.
Query q = em.createQuery("select e from MyEntity e where e.validTill > :today ");
and pass the :today parameter. But this is not I wanted. I want to do this using @Query annotation in the CrudRepository in Spring.
This is my code segment in the CrudRepository
@Query("SELECT e FROM MyEntity e WHERE e.validFrom < TODAY")
Iterable<MyEntity> findAllValid();
I don't know what I should put at the place TODAY to get the today's date. Please help me.
Aucun commentaire:
Enregistrer un commentaire