hibernate/hibernate-orm · error · HibernateException

Unable to resume JTA transaction after DDL execution

Error message

Unable to resume JTA transaction after DDL execution

What it means

HibernateException from DdlTransactionIsolatorJtaImpl.release(): after DDL completed, TransactionManager.resume(suspendedTransaction) threw. The DDL work itself is done, but the original JTA transaction could not be re-associated with its thread, so the caller's transaction context is broken and must be abandoned.

Source

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

		if ( jdbcConnection != null ) {
			try {
				jdbcContext.getJdbcConnectionAccess().releaseConnection( jdbcConnection );
			}
			catch (SQLException e) {
				throw jdbcContext.getSqlExceptionHelper()
						.convert( e, "Unable to release JDBC Connection used for DDL execution" );
			}
		}

		if ( suspendedTransaction != null ) {
			try {
				getJtaPlatform( jdbcContext )
						.retrieveTransactionManager()
						.resume( suspendedTransaction );
				JTA_LOGGER.resumedTransactionForDdlIsolation();
			}
			catch (Exception e) {
				throw new HibernateException( "Unable to resume JTA transaction after DDL execution" );
			}
		}
	}
}

View on GitHub (pinned to fad1729dce)

Solutions

  1. Abort and restart the affected transaction — it cannot be safely continued after this
  2. Move DDL out of transactions entirely (migration tooling) so nothing is suspended
  3. Raise the JTA transaction timeout above the worst-case DDL duration for maintenance runs
  4. Check TM logs for why the transaction was rejected on resume (timed out / marked rollback)

Example fix

// before
props.put("hibernate.hbm2ddl.auto", "update"); // DDL inside JTA; long DDL -> resume fails

// after
// run DDL in a maintenance step with no active transaction, then:
props.put("hibernate.hbm2ddl.auto", "validate");
Defensive patterns

Strategy: try-catch

Try / catch

catch (org.hibernate.HibernateException e) {
  // resume failed after DDL: the surrounding transaction is unusable — abort it,
  // verify DDL results on the DB, and restart the operation with a fresh transaction
}

Prevention

When it happens

Trigger: The suspended transaction timed out, rolled back, or became otherwise unresumable during long DDL execution; the TM raises InvalidTransactionException/SystemException on resume; TM failover or recovery occurred mid-DDL.

Common situations: Long schema updates executed while a live JTA transaction is suspended whose timeout expired; app-server managed transactions mixed with manual DDL; batch maintenance windows exceeding default transaction timeouts.

Related errors


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