The following scenario creates two top-level transactions and switches between them. The Math department is created in the first transaction, the French department in the second transaction. After the first transaction is committed, the inspection of all department instances shows only the Math department, then the second department is committed and both are visible when inspected.
| firstTransaction secondTransaction| firstTransaction:= Transaction begin: 'firstTransaction'. TstDepartmentHome singleton create department: 'Math'. secondTransaction :=Transaction begin: 'secondTransaction'. TstDepartmentHome singleton create department: 'French'. firstTransaction commit. Transaction current allInstances inspect.
At this point only the 'Math' department has been committed.
Transaction current.
The shared transaction is the current transaction at this point. It was the parent of the firstTransaction.
secondTransaction commit. TstDepartmentHome singleton allInstances inspect.
Now both the 'Math' and 'French' department have been committed.