• 出现Executing an update/delete query

    1
    InvalidDataAccessApiUsageException: Executing an update/delete query
    • 原因:执行update或delete语句时没有处理事物

    • 方法一:使用@Transactional注解

    1
    2
    3
    4
    @Modifying
    @Transactional
    @Query("update Wishes set wishStatus=:wishStatus where wishId=:wishId")
    int updateWishStatus(@Param("wishId")Integer wishId, @Param("wishStatus")Integer wishStatus);
    • 方法二:使用AOP声明式事务