Announcement Announcement Module
No announcement yet.
Nested transactions Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • Nested transactions

    I´m not too sure whether I understand the concept of PROPAGATION_REQUIRED

    Classic definition says “execute within a current transaction, create a new transaction if none exists"

    Imagine I define businessMethodA() in class A and businessMethodB() in class B both as PROPAGATION_REQUIRED

    Some day a developer makes a call from A.businessMethodA() to B.businessMethodB(), should I guess after B method completes a commit would be issued? Or better, does Spring recognize the sorrounding transaction of businessMethodA() and stops the commit until this method finishes?

    Let's consider the following sequence:

    1) A.businessMethodA() starts
    2) A calls B so B.businessMethodB() starts
    3) B.businessMethodB() ends
    4) A.businessMethodA() fails

    A rollback is issued but until which demarcation? Start of 4) or start of 1)?

  • #2
    A.businessMethodA() and B.businessMethodB() will both run within the same transaction and in your scenario the rollback will affect everything done since A.businessMethodA() started.

    The commit would be issued when A.businessMethodA() completes without causing a rollback.