We may wish to explicitly commit a transaction in our BPEL process. This recipe describes how to achieve this.
Getting ready
In JDeveloper, open the project containing the BPEL process that you wish to explicitly commit a transaction to.
How to do it...
Add a Dehydrate activity to the process.
Open the BPEL process that needs to explicitly commit the transaction.
From the Component Palette expand the Oracle Extensions section; drag a Dehydrate activity onto the BPEL process:
When executed, this will cause the current transaction to be committed and a new transaction to be started.
How it works...
The Dehydrate activity causes the current state of the BPEL process to be saved in the dehydration database. This also causes the current transaction context to be committed. Because the BPEL process is still active, a new transaction context is immediately created.
There's more...
A Dehydrate activity can be very useful in an asynchronous process, but should be avoided in a synchronous process unless the BPEL process's bpel.config.transaction property is not set or set to requiresNew.
Note
Synchronous BPEL processes that have the required transaction attribute should always leave the committing of the transaction to the caller; they should never force the committing of a transaction.
See also
The Catching rollback faults recipe in this chapter.