Skip Headers

# External Transaction Commit Exceptions

Previous

Next

When you use the unit of work with an external transaction service, commit exceptions may not be thrown until long after your application thread calls its `UnitOfWork` method `commit` and returns. In this case, commit exceptions are thrown to the client of the container-managed transaction (CMT) call, forcing the client to handle this server-side failure.

You can use the `UnitOfWork` method `writeChanges` to write changes to the data source before the external transaction commits. This allows your application thread to catch and handle most exceptions that could be thrown at the time the external transaction service commits the global transaction.

For more information about the `UnitOfWork` method `writeChanges`, including restrictions and warnings, see "Writing Changes Before Commit Time".

For more information on handling unit of work exceptions in general, see "Handling Exceptions".