PDA

View Full Version : Nested transactions



diegum
Aug 30th, 2004, 06:29 PM
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)?

trisberg
Aug 30th, 2004, 10:57 PM
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.