Skip to content Skip to sidebar Skip to footer

Spring Data Jpa - Query With The Date Minus 2 Days Not Working

I have this query that updates some prices higher that 2 days ago, but does not work @Transactional @Modifying @Query('update HotelDailyPrice hdp set hdp.price = (select

Solution 1:

Actually, JPA doesn't support time periods operations because not all databases support it. So you have following options:

  1. Calculate date programmatically (i.e. using calendar API or Java 8 Date Time API)
  2. Use native query
  3. Use concrete implementation if your JPA provider allows that. But AFAIK popular JPA providers don't give you such an option.

Post a Comment for "Spring Data Jpa - Query With The Date Minus 2 Days Not Working"