{"record":{"id":"1b16264ccff0ca4c","repo":"hibernate/hibernate-orm","slug":"unable-to-resume-jta-transaction-after-ddl-executi","errorCode":null,"errorMessage":"Unable to resume JTA transaction after DDL execution","messagePattern":"Unable to resume JTA transaction after DDL execution","errorType":"exception","errorClass":"HibernateException","httpStatus":null,"severity":"error","filePath":"hibernate-core/src/main/java/org/hibernate/resource/transaction/backend/jta/internal/DdlTransactionIsolatorJtaImpl.java","lineNumber":110,"sourceCode":"\t\tif ( jdbcConnection != null ) {\n\t\t\ttry {\n\t\t\t\tjdbcContext.getJdbcConnectionAccess().releaseConnection( jdbcConnection );\n\t\t\t}\n\t\t\tcatch (SQLException e) {\n\t\t\t\tthrow jdbcContext.getSqlExceptionHelper()\n\t\t\t\t\t\t.convert( e, \"Unable to release JDBC Connection used for DDL execution\" );\n\t\t\t}\n\t\t}\n\n\t\tif ( suspendedTransaction != null ) {\n\t\t\ttry {\n\t\t\t\tgetJtaPlatform( jdbcContext )\n\t\t\t\t\t\t.retrieveTransactionManager()\n\t\t\t\t\t\t.resume( suspendedTransaction );\n\t\t\t\tJTA_LOGGER.resumedTransactionForDdlIsolation();\n\t\t\t}\n\t\t\tcatch (Exception e) {\n\t\t\t\tthrow new HibernateException( \"Unable to resume JTA transaction after DDL execution\" );\n\t\t\t}\n\t\t}\n\t}\n}\n","sourceCodeStart":92,"sourceCodeEnd":115,"githubUrl":"https://github.com/hibernate/hibernate-orm/blob/fad1729dce015f908198d57a8d80274a30f905a5/hibernate-core/src/main/java/org/hibernate/resource/transaction/backend/jta/internal/DdlTransactionIsolatorJtaImpl.java#L92-L115","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Abort and restart the affected transaction — it cannot be safely continued after this","Move DDL out of transactions entirely (migration tooling) so nothing is suspended","Raise the JTA transaction timeout above the worst-case DDL duration for maintenance runs","Check TM logs for why the transaction was rejected on resume (timed out / marked rollback)"],"exampleFix":"// before\nprops.put(\"hibernate.hbm2ddl.auto\", \"update\"); // DDL inside JTA; long DDL -> resume fails\n\n// after\n// run DDL in a maintenance step with no active transaction, then:\nprops.put(\"hibernate.hbm2ddl.auto\", \"validate\");","handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"catch (org.hibernate.HibernateException e) {\n  // resume failed after DDL: the surrounding transaction is unusable — abort it,\n  // verify DDL results on the DB, and restart the operation with a fresh transaction\n}","preventionTips":["Run DDL outside active JTA transactions (maintenance mode, migration tooling)","Set the JTA transaction timeout above worst-case DDL duration","Watch TM logs for suspended-transaction timeouts during long operations"],"tags":["hibernate","jta","ddl","transaction-resume"],"backgroundTag":"jta-transaction-resume-failed","analyzedSha":"fad1729dce015f908198d57a8d80274a30f905a5","analyzedAt":"2026-08-22T04:13:57.527Z","schemaVersion":2},"datasetVersion":"2026-08-22T09:17:25.309Z"}