Oracle TopLink Developer's Guide
10g Release 3 (10.1.3) B13593-01 |
|
![]() Previous |
![]() Next |
By default, when you call the unit of work commit
method, TopLink writes your changes to the data source and commits your changes.
Alternatively, you can perform a two-stage or partial commit transaction by using the unit of work writeChanges
method prior to calling commit
(either directly or by way of an external transaction service).
When you call the unit of work writeChanges
method, the unit of work commit process begins, and all changes are written out to the data source. However, the data source transaction is not committed, nor will changes be merged into the shared session cache. To finalize your changes, the unit of work commit
method must still be called (either directly or by way of an external transaction service).
After you call the unit of work writeChanges
method, any attempt to register objects or execute object-level queries will throw an exception. You may execute report queries, noncaching queries, and data read and modify queries.
If any exception is thrown, the transaction will be rolled back (or marked rollback only) and you cannot recover the unit of work.
You can call this method only once. You cannot use this method to write out changes in an incremental fashion.
You can use the unit of work writeChanges
method to address a variety of transaction issues, including the following:
As an alternative to conforming (see "Using Unit of Work Method writeChanges Instead of Conforming")
To handle external transaction issues (see "Using the Unit of Work to Handle External Transaction Timeouts and Exceptions")