@Modifying(clearAutomatically = true)
@Transactional
@Query(value = "DELETE FROM transaction WHERE transaction_cre_sys_date <= (now() - interval 6 month)",nativeQuery = true)
void deleteSixMonthOldTransactions();
This is my Transaction entity. I want to delete the records older than 6 months
public class Transaction {
private Integer id;
private String transactionSource;
private String transactionId;
private LocalDateTime transactionCreSysDate;
}