Working with Transactions
At times you may need to make multiple updates as part of a single transaction. If anything goes wrong, you can roll back all save operations that are part of the transaction. If you register business objects as a child, grandchild, etc, of another business object, they automaticaly participate in the transaction of the parent/grandparent business object. To get this behavior to kick in, all you have to do is register the business objects and make sure the AutoSaveOnParentSaved property of the business objects is set to true you can set this at the ABusinessObject level so all your business objects behave this way when registered as child objects.
The parent business object raises a transaction state change event which causes all registered child business objects automatically particpate in this transaction too as shown in the following UML sequence diagram:
Handling Transactions Manually
If you prefer, the following business object methods provide manual control over transactional operations performed by business objects:
TransactionBegin
To start a transaction, simply call a business object's TransactionBegin method, which accepts an optional database key parameter. Calling this method causes all subsequent data access operations on the business object to be part of the transaction.TransactionCommit
When you're ready to commimt a transaction, just call the business object's TransactionCommit method. This causes the transaction to be committed, persisting all pending data updates. The business object raises a transaction state change event which causes all registered child business objects to clear the current transaction information.TransactionRollback
When you want to roll back a transaction, call the business object's TransactionRollback method. This causes all saves that occurred within the transaction to be rolled back. The business object raises a transaction state change event which causes all registered child business objects to clear the current transaction information.Automatic Transactions
If a business object's AutoUseTransactions property is true (it is by default), a transaction is automatically started when you call the SaveDataSet method. If the save is successful, the transaction is automatically committed. If the transaction fails (for example, broken rules are encountered) the transaction is automatically rolled back.See also:
Plugging into Business Object Events
© (c) 2026 Oak Leaf Enterprises, Inc., 1996-2026 • Updated: 07/28/18
Comment or report problem with topic
