Transaction control
You can use the target structure node attribute "Transaction control" to determine when SQL statements are written into the database. The following settings are possible. Important note: Please be aware that if you have several nodes with the same database alias and a commit was triggered by one node, a commit is always executed for all open SQL statements of this database alias. The first commit time for a database alias therefore always wins. So if you first have a node with transaction control "After record" and then a node with transaction control "All open statements", the commit by the second node also triggers a commit for the first node and there is no waiting until after the record has been created. However, if the nodes have different database aliases, different commit times are taken into account.
All open statements |
When exiting the node, a commit is triggered for all database aliases with open transactions. If the database cannot execute the commit, a rollback for the affected database alias will be executed. Note: This is not a two-phase commit! An executed commit for a database alias cannot be undone! Note: If a node with this setting is entered, already open transactions will not be closed but used. |
Only DB alias of this node |
This is the most common commit setting. When exiting the node, a commit is triggered for the associated database alias of the node. If the database cannot execute the commit, a rollback for the affected database alias will be executed. Note: If a node with this setting is entered, already open transactions will not be closed but used. |
After record |
When exiting the node, there is no commit sent to the database. This is the default setting. If all nodes of the target structure have this setting, a commit will not be triggered (to all involved database aliases) until the last node of the (partial) target tree of a record has been exited. A commit for a node is triggered if the parent node triggers a commit (starting with the (virtual) root node). So there is at least one commit per record. |
After all records |
With this setting, a commit is sent to the database after the last record has been processed. That means either all data of the node ends up in the database or none. Note: If a node with this setting is entered, already open transactions will not be closed but used. |
In response path |
The transaction behaviour is controlled with custom classes in phase 6. See sections CommitSqlSessionResponse a nd RollbackSqlSessionResponse . |