Java 调用MSSQL存储过程时Spring boot Data@Transactional不工作

Java 调用MSSQL存储过程时Spring boot Data@Transactional不工作,java,sql-server,spring-data-jpa,Java,Sql Server,Spring Data Jpa,我在试图从代码中调用存储过程时遇到了一些问题(不确定是否有帮助,但基本上是一些选择和插入) 这就是我到目前为止所做的: @Component @EnableTransactionManagement public class Inserter { @Transactional(propagation = Propagation.REQUIRED) public void saveAndCommit(Mapper mapper) { saveAll(...)

我在试图从代码中调用存储过程时遇到了一些问题(不确定是否有帮助,但基本上是一些选择和插入)

这就是我到目前为止所做的:

@Component
@EnableTransactionManagement
public class Inserter {
    @Transactional(propagation = Propagation.REQUIRED)
    public void saveAndCommit(Mapper mapper) {
       saveAll(...)
       ...
       softDeletes(mapper, this.containerRepository);
    }

    private <T, N> void saveAll(JpaRepository<T, N> repository, List<T> entityList) {
        if (entityList != null && !entityList.isEmpty()) {
            repository.saveAll(entityList);
        }
    }

    private void softDeletes(Mapper mapper, ContainerRepository containerRepository) {
        ...
    }
}
调用softDeletes时,我得到以下异常:

执行更新/删除查询;嵌套异常为javax.persistence.TransactionRequiredException:执行更新/删除查询

显然,saveAndCommit并没有为所有这些方法创建一个事务,但我不知道为什么。有什么想法吗

谢谢大家!

@Modifying
@Query(value = "EXEC SP_Soft_Deletes '...', '...', :state_container_id, :parent_id, :transaction_id, '...', :last_modification", nativeQuery = true)
void generateSoftDeletes(
    @Param("...") String ...,
    @Param("...") String ...,
    @Param("...") String ...,
    @Param("last_modification") LocalDateTime last_modification
);