Spring Bott 中的事务传播

发布于 2025-01-09 22:46:07 字数 446 浏览 4 评论 0原文

我如何在Spring Boot中实现以下内容。我需要调用第一个m1(),然后调用m2()

m1和m2是2个不同类中的2个方法,它们调用2个不同的存储过程。P_CODE是m1和m2返回的输出值。

   begin
        m1()
        if p_code==0
        {
        m2()
        end transaction
        }
        else
        {
        end transaction
        begin
        m2()
        end transaction
        }

   
  1. 当m1返回的p_code为0时,m1和m2应该属于同一个 交易。
  2. 当m1返回的p_code不为0时,则m1和m2 应该属于不同的事务。

How can i implement the below in Spring Boot.i need to calls 1st m1() and then m2()

m1 and m2 are 2 methods in 2 different classes which calls 2 different stored procedure .P_CODE is the ouput value retuned by m1 and m2 .

   begin
        m1()
        if p_code==0
        {
        m2()
        end transaction
        }
        else
        {
        end transaction
        begin
        m2()
        end transaction
        }

   
  1. When p_code retuned by m1 is 0 then m1 and m2 should belong to same
    transaction.
  2. When p_code retuned by m1 is not 0 then m1 and m2
    should belong to different transaction.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文