How could I draw the database transaction commit in the sequence diagram?
I want to draw in sequence diagram database transaction commit/rollback process
Software Engineering Stack Exchange is a question and answer site for professionals, academics, and students working within the systems development life cycle. It only takes a minute to sign up.Sign up to join this community
First, define use cases for the transaction you are modeling. Define versions of the use case for happy path, and each of the rollback scenarios you wish to model. Each of these use case variations can be presented as a separate sequence diagram.
Consider a very simple transaction -- client updates two tables, T1 and T2. Both updates need to succeed, or neither table gets changed. There are three interesting use cases --
The Happy Path -- both updates succeed.
Update to T1 fails.
Update to T1 succeeds, update to T2 fails, update to T1 is rolled back.
So you have three sequence diagrams, one for each case.
The third sequence diagram might look like this:
Client Database | | |--begin trans.--->| | | |<-trans. started--| | | |----update T1---->| | |----: | | : | | DB established rollback point | | : | |<---: | |----: | | : | | DB Updates T1 | | : | |<---: |<---T1 updated----| | | |----update T2---->| | |----: | | : | | Update Fails | | : | |<---: | |----: | | : | | DB Rolls back T1 Update | | : | |<---: | | |<---trans. error--|