Skip Headers

# Commit and JTA

Previous

Next

When your application uses JTA, the unit of work commit transaction acts differently than in a non-JTA application. In most cases, the unit of work attaches itself to an external transaction. If no transaction exists, the unit of work creates a transaction. This distinction affects commit activity as follows:

- If the unit of work attaches to an existing transaction, the unit of work ignores the `commit` call. The transaction commits the unit of work when the entire external transaction is complete.

- If the unit of work starts the external transaction, the transaction treats the unit of work `commit` call as a request to commit the external transaction. The external transaction then calls its own commit code on the database.

In either case, only the external transaction can call `commit` on the database because it owns the database connection.

For more information, see "Integrating the Unit of Work With an External Transaction Service".