Nesting transactions
Although the syntax supports nested transactions, IBM® Product Master does not support nesting of transactions.
Product Master interpretation of the examplecolumn.
Nested transaction example | Product Master interpretation of the example |
---|---|
|
|
Attempt to nest through a library | Scripting library 'saveAnother2Entities' |
---|---|
|
|
This example is identical to the previous one, in that a call to useTransaction
was made inside an existing useTransaction
block, except the usage is now hidden.
Both approaches cause the original transaction to be prematurely committed. When you attempt to
ensure that a section of script is within a transaction and you are unsure if you are already in a
transaction, use startTransaction
instead.
With the addition of savepoint support to the Java™ API, it is possible to perform partial rollbacks within a transaction and achieve many of the wanted results of nested transactions. This feature is intended for use from Java code with Java API, but because Java API methods can also be accessed from scripts by using reflection, the capabilities are also available to the script developer. Consult the Java API documentation to learn how to use the savepoint methods and how to use reflection to call them from scripts.