hibernate/hibernate-orm · error · TransactionException

Unable to suspend current JTA transaction

Error message

Unable to suspend current JTA transaction

What it means

TransactionException from JtaIsolationDelegate.doInSuspendedTransaction(): TransactionManager.suspend() threw SystemException before any isolated work could run. This delegate performs Hibernate's isolated operations under JTA (table-generator ID segment fetches, sequence information extraction, DDL helpers), so the failure happens during otherwise ordinary persistence operations.

Source

Thrown at hibernate-core/src/main/java/org/hibernate/resource/transaction/backend/jta/internal/JtaIsolationDelegate.java:106

		try {
			return callable.call();
		}
		catch ( HibernateException e ) {
			throw e;
		}
		catch ( Exception e ) {
			throw new HibernateException( e );
		}
	}

	private <T> T doInSuspendedTransaction(HibernateCallable<T> callable) {
		final Transaction surroundingTransaction;
		try {
			// suspend current JTA transaction, if any
			surroundingTransaction = suspend();
		}
		catch ( SystemException systemException ) {
			throw new TransactionException( "Unable to suspend current JTA transaction", systemException );
		}

		Throwable exception = null;
		try {
			return callable.call();
		}
		catch ( HibernateException he ) {
			exception = he;
			throw he;
		}
		catch ( Throwable throwable ) {
			exception = throwable;
			throw new HibernateException( "Unable to perform isolated work", throwable );
		}
		finally {
			try {
				// resume the JTA transaction we suspended
				resume( surroundingTransaction );

View on GitHub (pinned to fad1729dce)

Solutions

  1. Check the SystemException error code and the TransactionManager logs for the suspend failure
  2. Avoid table-based ID generators in JTA environments (prefer SEQUENCE/IDENTITY) so this isolated delegate path is not needed
  3. Repair the TM configuration and retry the operation
  4. Upgrade the TM/Hibernate combination to a tested pairing

Example fix

// before
@TableGenerator(name = "ids", table = "id_gen") // triggers isolated work under JTA -> suspend()

// after
@SequenceGenerator(name = "ids", sequenceName = "id_seq")
// sequence access needs no suspend/resume isolation in the common case
Defensive patterns

Strategy: try-catch

Try / catch

catch (org.hibernate.TransactionException e) {
  // suspend failed before isolated work ran: inspect the SystemException cause and TM
  // logs; either repair the TM and retry the operation, or avoid the isolated-work path
}

Prevention

When it happens

Trigger: Any Hibernate isolated work in a JTA environment when the TM fails suspend(): broken or shutting-down TransactionManager, corrupted thread-transaction association, in-test TM stubs that throw on suspend.

Common situations: Misconfigured or half-started Narayana/Atomikos during deployments; test harnesses with partial JTA stubs; the first insert using a @TableGenerator under JTA hitting the delegate while the TM is unhealthy.

Related errors


AI-assisted analysis of hibernate/hibernate-orm@fad1729dce (2026-08-22). Data as JSON: /api/errors/44564998dd1f7b33. Report an issue: GitHub.