The persistence implementation is using the Unit Of Work implementation and the UnitOfWorkProtocol aspect to achive completely transparent persistence. You can register one or many listeners to the Unit Of Work which will be called upon begin, commit, rollback etc.
Each persistence component consists of two parts:
- A persistence manager which has to implement the
- A Unit Of Work listener, which has to implement the
See the UnitOfWorkProtocol for details on how to define the Unit Of Work aspect, e.g. on which methods a new transaction should be started, committed and rollbacked, which domain objects you want to to become transactional (you want to persist) etc.
All persistence implementations works great in conjunction with each other or with the Transaction Demarcation component, which can for example make the persistence management aware of JTA two-phase commit transactions etc. You just register your listeners in the Unit Of Work and the complete transaction will not be committed until all listeners have agreed on that.
h2: Persistence Schemes