10.7.9. JTA Transaction Error Handling
10.7.9.1. Handle Transaction Errors
Note
This type of error often manifests itself when Hibernate is unable to obtain a database connection for lazy loading. If it happens frequently, you can lengthen the timeout value. Refer to Section 10.7.8.2, “Configure the Transaction Manager”.
NotSupportedException
exception
The NotSupportedException
exception usually indicates that you attempted to nest a JTA transaction, and this is not supported. If you were not attempting to nest a transaction, it is likely that another transaction was started in a thread pool task, but finished the task without suspending or ending the transaction.
UserTransaction
, which handles this automatically. If so, there may be a problem with a framework.
TransactionManager
or Transaction
methods directly, be aware of the following behavior when committing or rolling back a transaction. If your code uses TransactionManager
methods to control your transactions, committing or rolling back a transaction disassociates the transaction from the current thread. However, if your code uses Transaction
methods, the transaction may not be associated with the running thread, and you need to disassociate it from its threads manually, before returning it to the thread pool.
This error happens if you try to enlist a second non-XA resource into a transaction. If you need multiple resources in a transaction, they must be XA.