Spring Data JPA delete语句

执行delete和update语句,需要添加@Modifying注解,使用时在Repository或者更上层需要@Transactional注解。

例如:

@Query(value = "delete from r_upa where user_id= ?1 and point_indecs_id in (?2)", nativeQuery = true)
@Modifying
void deleteByUserAndPointIndecs(Long uid, List hids);
@Modifying
@Query("update Customer d set d.isLogicDel = 1  where d.member.id = ?1 and d.dispatchDate  = ?2 ")
public int updateCustomer(Long memberId, Date dispatchDate);
参考链接:

https://www.cnblogs.com/purplelightning/p/4670941.html

http://www.voidcn.com/article/p-gfybofix-cb.html
--------------------- 
作者:yfraquelle 
来源:CSDN 
原文:https://blog.csdn.net/y_f_raquelle/article/details/79773522 
版权声明:本文为博主原创文章,转载请附上博文链接!

你可能感兴趣的:(Spring Data JPA delete语句)