{"record":{"id":"44564998dd1f7b33","repo":"hibernate/hibernate-orm","slug":"unable-to-suspend-current-jta-transaction","errorCode":null,"errorMessage":"Unable to suspend current JTA transaction","messagePattern":"Unable to suspend current JTA transaction","errorType":"exception","errorClass":"TransactionException","httpStatus":null,"severity":"error","filePath":"hibernate-core/src/main/java/org/hibernate/resource/transaction/backend/jta/internal/JtaIsolationDelegate.java","lineNumber":106,"sourceCode":"\t\ttry {\n\t\t\treturn callable.call();\n\t\t}\n\t\tcatch ( HibernateException e ) {\n\t\t\tthrow e;\n\t\t}\n\t\tcatch ( Exception e ) {\n\t\t\tthrow new HibernateException( e );\n\t\t}\n\t}\n\n\tprivate <T> T doInSuspendedTransaction(HibernateCallable<T> callable) {\n\t\tfinal Transaction surroundingTransaction;\n\t\ttry {\n\t\t\t// suspend current JTA transaction, if any\n\t\t\tsurroundingTransaction = suspend();\n\t\t}\n\t\tcatch ( SystemException systemException ) {\n\t\t\tthrow new TransactionException( \"Unable to suspend current JTA transaction\", systemException );\n\t\t}\n\n\t\tThrowable exception = null;\n\t\ttry {\n\t\t\treturn callable.call();\n\t\t}\n\t\tcatch ( HibernateException he ) {\n\t\t\texception = he;\n\t\t\tthrow he;\n\t\t}\n\t\tcatch ( Throwable throwable ) {\n\t\t\texception = throwable;\n\t\t\tthrow new HibernateException( \"Unable to perform isolated work\", throwable );\n\t\t}\n\t\tfinally {\n\t\t\ttry {\n\t\t\t\t// resume the JTA transaction we suspended\n\t\t\t\tresume( surroundingTransaction );","sourceCodeStart":88,"sourceCodeEnd":124,"githubUrl":"https://github.com/hibernate/hibernate-orm/blob/fad1729dce015f908198d57a8d80274a30f905a5/hibernate-core/src/main/java/org/hibernate/resource/transaction/backend/jta/internal/JtaIsolationDelegate.java#L88-L124","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Check the SystemException error code and the TransactionManager logs for the suspend failure","Avoid table-based ID generators in JTA environments (prefer SEQUENCE/IDENTITY) so this isolated delegate path is not needed","Repair the TM configuration and retry the operation","Upgrade the TM/Hibernate combination to a tested pairing"],"exampleFix":"// before\n@TableGenerator(name = \"ids\", table = \"id_gen\") // triggers isolated work under JTA -> suspend()\n\n// after\n@SequenceGenerator(name = \"ids\", sequenceName = \"id_seq\")\n// sequence access needs no suspend/resume isolation in the common case","handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"catch (org.hibernate.TransactionException e) {\n  // suspend failed before isolated work ran: inspect the SystemException cause and TM\n  // logs; either repair the TM and retry the operation, or avoid the isolated-work path\n}","preventionTips":["Prefer SEQUENCE/IDENTITY generators over TABLE generators in JTA environments to avoid the isolation delegate","Keep the JTA TransactionManager healthy and fully started before app traffic","Avoid partial JTA stubs in tests; use a real embedded TM (Narayana) when testing JTA paths"],"tags":["hibernate","jta","transaction-suspend","id-generation"],"backgroundTag":"jta-transaction-suspend-failed","analyzedSha":"fad1729dce015f908198d57a8d80274a30f905a5","analyzedAt":"2026-08-22T04:13:57.527Z","schemaVersion":2},"datasetVersion":"2026-08-22T09:17:25.309Z"}