是因為在做SpringDataJpa更新和刪除操作的時候Repository層沒有加事務的注解,加上就行了:
@Transactional @Query(value = "update msg_status msg set msg.`status` = 1 where msg.id = ?1 and msg.user_phone = ?2", nativeQuery = true) int updateMsg(String id, String phone);
是因為在做SpringDataJpa更新和刪除操作的時候Repository層沒有加事務的注解,加上就行了:
@Transactional @Query(value = "update msg_status msg set msg.`status` = 1 where msg.id = ?1 and msg.user_phone = ?2", nativeQuery = true) int updateMsg(String id, String phone);
本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。