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 avg (hp.price) "
+ "from HotelPrice hp where hp.id = ?1 and hp.updateDate > CURRENT_DATE - 2), hdp.day = ?2 ")
void updateDailyAveragePrice (Hotel hotel, String dayDate);
Actually, JPA doesn't support time periods operations because not all databases support it. So you have following options:
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With