Processing transactions
The transaction scope can be controlled by a client API call, but it must be designed carefully.
About this task
To group a set of API calls into a transaction, you must build it by completing the following steps:
Procedure
- Call the startTransaction method of
the DKDatastoreICM class. You work with the DKDatastoreICM class methods to complete all the transaction steps.
- Call all of APIs that you want to include in the transaction in the order in which you want them called.
- Call the commit or rollback methods to end the transaction.
Results
All of the API calls made between the startTransaction method, and either the commit or rollback method, are treated as a single transaction.
All APIs can be included in transactions, unless specifically noted. See the Application Programming Reference for details. Some administrative APIs, such as the methods to define or update item types, cannot be included in transactions.
Example
The following class methods are used in IBM® Content Manager item creation and update transactions:
- DKDatastoreICM.startTransaction()
- Starts a transaction.
- DKDatastoreICM.commit()
- Commits transaction changes to the database.
- DKDatastoreICM.rollback()
- Rolls back or removes transaction changes from the database.
- DKDatastoreICM.checkOut()
- Acquires a persistent write lock on an item.
- DKDatastoreICM.checkIn()
- Releases a previously acquired persistent write lock.
- DKDatastoreICM.add()
- Creates an item in the database.
- DKDatastoreICM.updateObject()
- Updates an item. The item must be checked out prior to calling this method.
- DKDatastoreICM.retrieveObject()
- Retrieves an item from the database.
- DKDatastoreICM.deleteObject()
- Deletes an item from the database.
- DKDatastoreICM.moveObject()
- Reindexes an item. Moves an item from one item type to another item type. The item must be checked out prior to calling this method.
An additional source for information about transactions is the SItemUpdateICM sample.