How could I draw the database transaction commit in the sequence diagram?EDITI want to draw in sequence diagram database transaction commit/rollback process
how could I draw the database transaction commit in the sequence diagram
diagrams;sequence;transaction
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--|