Spring Data JPA Using @Query

来源:互联网 发布:小米手机怎么数据迁移 编辑:程序博客网 时间:2024/06/04 18:46
public interface RepaysRepository extends JpaRepository<Repays, Long> {    @Query(value = "delete from t_repays where create_time < DATE_ADD( NOW(),INTERVAL :interval DAY)",nativeQuery=true)    @Modifying    void deleteRepaysByCreateTime(@Param("interval") int interval); }
public interface LoansRepository extends JpaRepository<Loans, Long> {    @Query(value = "delete from t_loans where create_time < DATE_ADD( NOW(),INTERVAL ?1 DAY)",nativeQuery=true)    @Modifying    void deleteLoansByCreateTime(int interval);    }

http://docs.spring.io/spring-data/jpa/docs/2.0.0.M4/reference/html/

原创粉丝点击