Replay Changes

Problem

How can a client application preserve a user's changes after aborting a transaction?

Context

You are developing a multi-user application that commits transactions on an application server. There are several reasons why you might want to be able to replay a user's business transaction after aborting a server transaction:

Forces

Solution

The client keeps the changes independent from the view of the repository, so that when a view is refreshed, the changes may be replayed.

Resulting Context

In order to be able to replay changes, you need to be able to identify the changes that were made as part of the current business transaction, as explained in the Transaction Specification pattern.

Two different strategies for replaying changes are described in:

Rationale

There are two benefits to this solution:

  1. Changes to persistent objects can be made outside of a server transaction, which allows you to implement long business transactions with short server transactions.

  2. You do not lose a user's changes when a commit failure occurs.

Related Patterns