What is a transaction boundary?
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
add a comment |
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
add a comment |
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
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
java java-ee transactions jta distributed-transactions
asked Nov 15 '18 at 7:16
TheeNinjaDevTheeNinjaDev
2551314
2551314
add a comment |
add a comment |
2 Answers
2
active
oldest
votes
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.
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
add a comment |
You can read Spring Transaction boundaries reference:
For example, a gateway or service activator method could be annotated with
@Transactional
, or aTransactionInterceptor
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.
add a comment |
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
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
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
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.
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
add a comment |
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.
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
add a comment |
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.
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.
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
add a comment |
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
add a comment |
You can read Spring Transaction boundaries reference:
For example, a gateway or service activator method could be annotated with
@Transactional
, or aTransactionInterceptor
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.
add a comment |
You can read Spring Transaction boundaries reference:
For example, a gateway or service activator method could be annotated with
@Transactional
, or aTransactionInterceptor
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.
add a comment |
You can read Spring Transaction boundaries reference:
For example, a gateway or service activator method could be annotated with
@Transactional
, or aTransactionInterceptor
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.
You can read Spring Transaction boundaries reference:
For example, a gateway or service activator method could be annotated with
@Transactional
, or aTransactionInterceptor
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.
answered Nov 15 '18 at 7:47
user7294900user7294900
24k123464
24k123464
add a comment |
add a comment |
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.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
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
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
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