The Unit Of Work pattern is a common pattern in enterprise application architectures.
It can be used for implementing:
- transparent persistence
- transaction demarcation
It implements the concept of an "application transaction" that keeps track of:
It records the state of the objects, by tracking field changes, as it is before the transaction is started and will then rollback the state in memory upon rollback of the transaction. It allows adding additional behavior at commit, rollback etc., for example store all new, update all dirty and remove all removed objects in a persistent storage.
- TX SUPPORTS
- TX MANDATORY
- TX NEVER
- (TX REQUIRES and
- TX REQUIRES NEW is not yet fully implemented)
The user can implement listeners that allows him to trigger additional behaviour on specific events, such as begin, commit, rollback, dispose etc.