What is a transaction boundary?










1















I've read this article (assumes I already know what a transaction boundary is) and this SO question (can't decipher meaning of transaction boundary from that question). In other words, there are no clear definitions or attempts at definitions for transaction boundary that I have found. I understand what a transition is 100%, but what is a transaction boundary conceptually?










share|improve this question


























    1















    I've read this article (assumes I already know what a transaction boundary is) and this SO question (can't decipher meaning of transaction boundary from that question). In other words, there are no clear definitions or attempts at definitions for transaction boundary that I have found. I understand what a transition is 100%, but what is a transaction boundary conceptually?










    share|improve this question
























      1












      1








      1








      I've read this article (assumes I already know what a transaction boundary is) and this SO question (can't decipher meaning of transaction boundary from that question). In other words, there are no clear definitions or attempts at definitions for transaction boundary that I have found. I understand what a transition is 100%, but what is a transaction boundary conceptually?










      share|improve this question














      I've read this article (assumes I already know what a transaction boundary is) and this SO question (can't decipher meaning of transaction boundary from that question). In other words, there are no clear definitions or attempts at definitions for transaction boundary that I have found. I understand what a transition is 100%, but what is a transaction boundary conceptually?







      java java-ee transactions jta distributed-transactions






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Nov 15 '18 at 7:16









      TheeNinjaDevTheeNinjaDev

      2551314




      2551314






















          2 Answers
          2






          active

          oldest

          votes


















          3














          It's where the transaction starts or is committed/rollbacked.



          A method annotated with @Transactional for example defines two transaction boundaries: when the method is called, a transaction starts, and when it returns, the transaction is committed/rollbacked.






          share|improve this answer























          • If there is an error in my transaction between transaction boundaries, does it only rollback at the next transaction boundary as opposed to right away?

            – TheeNinjaDev
            Nov 15 '18 at 18:56






          • 1





            By definition, it rollbacks at the next transaction boundary, since a transaction boundary defines when the transaction rollbacks. It you're asking when a transaction rollbacks when you call a transactional method, it's after the method returns or throws.

            – JB Nizet
            Nov 15 '18 at 19:04











          • I think I understand now, if I wanted to rollback before all the stuff in the method was done I would early-return / throw which triggers the rollback?

            – TheeNinjaDev
            Nov 15 '18 at 19:11











          • Yes, in most cases, what causes a rollback is an exception being thrown and bubbling up until it's thrown from the method which started the transaction.

            – JB Nizet
            Nov 15 '18 at 19:13


















          1














          You can read Spring Transaction boundaries reference:




          For example, a gateway or service activator method could be annotated with @Transactional, or a TransactionInterceptor could be defined in an XML configuration with a pointcut expression that pointa to specific methods that should be transactional. The bottom line is that you have full control over transaction configuration and boundaries in these scenarios.



          Another important factor is the boundaries of Transactions within a Message flow. When a transaction is started, the transaction context is bound to the current thread. So regardless of how many endpoints and channels you have in your Message flow your transaction context will be preserved as long as you are ensuring that the flow continues on the same thread. As soon as you break it by introducing a Pollable Channel or Executor Channel or initiate a new thread manually in some service, the Transactional boundary will be broken as well.







          share|improve this answer























            Your Answer






            StackExchange.ifUsing("editor", function ()
            StackExchange.using("externalEditor", function ()
            StackExchange.using("snippets", function ()
            StackExchange.snippets.init();
            );
            );
            , "code-snippets");

            StackExchange.ready(function()
            var channelOptions =
            tags: "".split(" "),
            id: "1"
            ;
            initTagRenderer("".split(" "), "".split(" "), channelOptions);

            StackExchange.using("externalEditor", function()
            // Have to fire editor after snippets, if snippets enabled
            if (StackExchange.settings.snippets.snippetsEnabled)
            StackExchange.using("snippets", function()
            createEditor();
            );

            else
            createEditor();

            );

            function createEditor()
            StackExchange.prepareEditor(
            heartbeatType: 'answer',
            autoActivateHeartbeat: false,
            convertImagesToLinks: true,
            noModals: true,
            showLowRepImageUploadWarning: true,
            reputationToPostImages: 10,
            bindNavPrevention: true,
            postfix: "",
            imageUploader:
            brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
            contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
            allowUrls: true
            ,
            onDemand: true,
            discardSelector: ".discard-answer"
            ,immediatelyShowMarkdownHelp:true
            );



            );













            draft saved

            draft discarded


















            StackExchange.ready(
            function ()
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53314207%2fwhat-is-a-transaction-boundary%23new-answer', 'question_page');

            );

            Post as a guest















            Required, but never shown

























            2 Answers
            2






            active

            oldest

            votes








            2 Answers
            2






            active

            oldest

            votes









            active

            oldest

            votes






            active

            oldest

            votes









            3














            It's where the transaction starts or is committed/rollbacked.



            A method annotated with @Transactional for example defines two transaction boundaries: when the method is called, a transaction starts, and when it returns, the transaction is committed/rollbacked.






            share|improve this answer























            • If there is an error in my transaction between transaction boundaries, does it only rollback at the next transaction boundary as opposed to right away?

              – TheeNinjaDev
              Nov 15 '18 at 18:56






            • 1





              By definition, it rollbacks at the next transaction boundary, since a transaction boundary defines when the transaction rollbacks. It you're asking when a transaction rollbacks when you call a transactional method, it's after the method returns or throws.

              – JB Nizet
              Nov 15 '18 at 19:04











            • I think I understand now, if I wanted to rollback before all the stuff in the method was done I would early-return / throw which triggers the rollback?

              – TheeNinjaDev
              Nov 15 '18 at 19:11











            • Yes, in most cases, what causes a rollback is an exception being thrown and bubbling up until it's thrown from the method which started the transaction.

              – JB Nizet
              Nov 15 '18 at 19:13















            3














            It's where the transaction starts or is committed/rollbacked.



            A method annotated with @Transactional for example defines two transaction boundaries: when the method is called, a transaction starts, and when it returns, the transaction is committed/rollbacked.






            share|improve this answer























            • If there is an error in my transaction between transaction boundaries, does it only rollback at the next transaction boundary as opposed to right away?

              – TheeNinjaDev
              Nov 15 '18 at 18:56






            • 1





              By definition, it rollbacks at the next transaction boundary, since a transaction boundary defines when the transaction rollbacks. It you're asking when a transaction rollbacks when you call a transactional method, it's after the method returns or throws.

              – JB Nizet
              Nov 15 '18 at 19:04











            • I think I understand now, if I wanted to rollback before all the stuff in the method was done I would early-return / throw which triggers the rollback?

              – TheeNinjaDev
              Nov 15 '18 at 19:11











            • Yes, in most cases, what causes a rollback is an exception being thrown and bubbling up until it's thrown from the method which started the transaction.

              – JB Nizet
              Nov 15 '18 at 19:13













            3












            3








            3







            It's where the transaction starts or is committed/rollbacked.



            A method annotated with @Transactional for example defines two transaction boundaries: when the method is called, a transaction starts, and when it returns, the transaction is committed/rollbacked.






            share|improve this answer













            It's where the transaction starts or is committed/rollbacked.



            A method annotated with @Transactional for example defines two transaction boundaries: when the method is called, a transaction starts, and when it returns, the transaction is committed/rollbacked.







            share|improve this answer












            share|improve this answer



            share|improve this answer










            answered Nov 15 '18 at 7:23









            JB NizetJB Nizet

            547k588941021




            547k588941021












            • If there is an error in my transaction between transaction boundaries, does it only rollback at the next transaction boundary as opposed to right away?

              – TheeNinjaDev
              Nov 15 '18 at 18:56






            • 1





              By definition, it rollbacks at the next transaction boundary, since a transaction boundary defines when the transaction rollbacks. It you're asking when a transaction rollbacks when you call a transactional method, it's after the method returns or throws.

              – JB Nizet
              Nov 15 '18 at 19:04











            • I think I understand now, if I wanted to rollback before all the stuff in the method was done I would early-return / throw which triggers the rollback?

              – TheeNinjaDev
              Nov 15 '18 at 19:11











            • Yes, in most cases, what causes a rollback is an exception being thrown and bubbling up until it's thrown from the method which started the transaction.

              – JB Nizet
              Nov 15 '18 at 19:13

















            • If there is an error in my transaction between transaction boundaries, does it only rollback at the next transaction boundary as opposed to right away?

              – TheeNinjaDev
              Nov 15 '18 at 18:56






            • 1





              By definition, it rollbacks at the next transaction boundary, since a transaction boundary defines when the transaction rollbacks. It you're asking when a transaction rollbacks when you call a transactional method, it's after the method returns or throws.

              – JB Nizet
              Nov 15 '18 at 19:04











            • I think I understand now, if I wanted to rollback before all the stuff in the method was done I would early-return / throw which triggers the rollback?

              – TheeNinjaDev
              Nov 15 '18 at 19:11











            • Yes, in most cases, what causes a rollback is an exception being thrown and bubbling up until it's thrown from the method which started the transaction.

              – JB Nizet
              Nov 15 '18 at 19:13
















            If there is an error in my transaction between transaction boundaries, does it only rollback at the next transaction boundary as opposed to right away?

            – TheeNinjaDev
            Nov 15 '18 at 18:56





            If there is an error in my transaction between transaction boundaries, does it only rollback at the next transaction boundary as opposed to right away?

            – TheeNinjaDev
            Nov 15 '18 at 18:56




            1




            1





            By definition, it rollbacks at the next transaction boundary, since a transaction boundary defines when the transaction rollbacks. It you're asking when a transaction rollbacks when you call a transactional method, it's after the method returns or throws.

            – JB Nizet
            Nov 15 '18 at 19:04





            By definition, it rollbacks at the next transaction boundary, since a transaction boundary defines when the transaction rollbacks. It you're asking when a transaction rollbacks when you call a transactional method, it's after the method returns or throws.

            – JB Nizet
            Nov 15 '18 at 19:04













            I think I understand now, if I wanted to rollback before all the stuff in the method was done I would early-return / throw which triggers the rollback?

            – TheeNinjaDev
            Nov 15 '18 at 19:11





            I think I understand now, if I wanted to rollback before all the stuff in the method was done I would early-return / throw which triggers the rollback?

            – TheeNinjaDev
            Nov 15 '18 at 19:11













            Yes, in most cases, what causes a rollback is an exception being thrown and bubbling up until it's thrown from the method which started the transaction.

            – JB Nizet
            Nov 15 '18 at 19:13





            Yes, in most cases, what causes a rollback is an exception being thrown and bubbling up until it's thrown from the method which started the transaction.

            – JB Nizet
            Nov 15 '18 at 19:13













            1














            You can read Spring Transaction boundaries reference:




            For example, a gateway or service activator method could be annotated with @Transactional, or a TransactionInterceptor could be defined in an XML configuration with a pointcut expression that pointa to specific methods that should be transactional. The bottom line is that you have full control over transaction configuration and boundaries in these scenarios.



            Another important factor is the boundaries of Transactions within a Message flow. When a transaction is started, the transaction context is bound to the current thread. So regardless of how many endpoints and channels you have in your Message flow your transaction context will be preserved as long as you are ensuring that the flow continues on the same thread. As soon as you break it by introducing a Pollable Channel or Executor Channel or initiate a new thread manually in some service, the Transactional boundary will be broken as well.







            share|improve this answer



























              1














              You can read Spring Transaction boundaries reference:




              For example, a gateway or service activator method could be annotated with @Transactional, or a TransactionInterceptor could be defined in an XML configuration with a pointcut expression that pointa to specific methods that should be transactional. The bottom line is that you have full control over transaction configuration and boundaries in these scenarios.



              Another important factor is the boundaries of Transactions within a Message flow. When a transaction is started, the transaction context is bound to the current thread. So regardless of how many endpoints and channels you have in your Message flow your transaction context will be preserved as long as you are ensuring that the flow continues on the same thread. As soon as you break it by introducing a Pollable Channel or Executor Channel or initiate a new thread manually in some service, the Transactional boundary will be broken as well.







              share|improve this answer

























                1












                1








                1







                You can read Spring Transaction boundaries reference:




                For example, a gateway or service activator method could be annotated with @Transactional, or a TransactionInterceptor could be defined in an XML configuration with a pointcut expression that pointa to specific methods that should be transactional. The bottom line is that you have full control over transaction configuration and boundaries in these scenarios.



                Another important factor is the boundaries of Transactions within a Message flow. When a transaction is started, the transaction context is bound to the current thread. So regardless of how many endpoints and channels you have in your Message flow your transaction context will be preserved as long as you are ensuring that the flow continues on the same thread. As soon as you break it by introducing a Pollable Channel or Executor Channel or initiate a new thread manually in some service, the Transactional boundary will be broken as well.







                share|improve this answer













                You can read Spring Transaction boundaries reference:




                For example, a gateway or service activator method could be annotated with @Transactional, or a TransactionInterceptor could be defined in an XML configuration with a pointcut expression that pointa to specific methods that should be transactional. The bottom line is that you have full control over transaction configuration and boundaries in these scenarios.



                Another important factor is the boundaries of Transactions within a Message flow. When a transaction is started, the transaction context is bound to the current thread. So regardless of how many endpoints and channels you have in your Message flow your transaction context will be preserved as long as you are ensuring that the flow continues on the same thread. As soon as you break it by introducing a Pollable Channel or Executor Channel or initiate a new thread manually in some service, the Transactional boundary will be broken as well.








                share|improve this answer












                share|improve this answer



                share|improve this answer










                answered Nov 15 '18 at 7:47









                user7294900user7294900

                24k123464




                24k123464



























                    draft saved

                    draft discarded
















































                    Thanks for contributing an answer to Stack Overflow!


                    • Please be sure to answer the question. Provide details and share your research!

                    But avoid


                    • Asking for help, clarification, or responding to other answers.

                    • Making statements based on opinion; back them up with references or personal experience.

                    To learn more, see our tips on writing great answers.




                    draft saved


                    draft discarded














                    StackExchange.ready(
                    function ()
                    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53314207%2fwhat-is-a-transaction-boundary%23new-answer', 'question_page');

                    );

                    Post as a guest















                    Required, but never shown





















































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown

































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown







                    Popular posts from this blog

                    How to how show current date and time by default on contact form 7 in WordPress without taking input from user in datetimepicker

                    Syphilis

                    Darth Vader #20