Skip Headers

# Using a Unit of Work When No External Transaction Exists

Previous

Next

When the `getActiveUnitOfWork` method returns a null unit of work, there is no existing external transaction. You must start a new external transaction.

Do this either by starting an external transaction explicitly using the `UserTransaction` interface, or by acquiring a new unit of work using the `acquireUnitOfWork` method on the server session.

Use the unit of work as usual.

Once the modifications to registered objects are complete, you must commit the transaction either explicitly through the `UserTransaction` interface or by calling the unit of work `commit` method.

The transaction synchronization callbacks are then invoked on, and the database updates and cache merge occur based upon those callbacks.

Unit of Work When No External Transaction Exists

Description of "Unit of Work When No External Transaction Exists"