{"record":{"id":"f16a3e1125250eb4","repo":"hibernate/hibernate-orm","slug":"error-performing-work","errorCode":null,"errorMessage":"Error performing work","messagePattern":"Error performing work","errorType":"exception","errorClass":"HibernateException","httpStatus":null,"severity":"error","filePath":"hibernate-core/src/main/java/org/hibernate/resource/transaction/backend/jta/internal/JtaIsolationDelegate.java","lineNumber":174,"sourceCode":"\t\t\ttransactionManager.begin();\n\t\t}\n\t\tcatch ( SystemException | NotSupportedException exception ) {\n\t\t\tthrow new TransactionException( \"Unable to start isolated transaction\", exception );\n\t\t}\n\n\t\ttry {\n\t\t\tT result = callable.call();\n\t\t\t// if everything went ok, commit the isolated transaction\n\t\t\ttransactionManager.commit();\n\t\t\treturn result;\n\t\t}\n\t\tcatch ( Exception exception ) { //TODO: should this be Throwable\n\t\t\trollBack( transactionManager, exception );\n\t\t\tif ( exception instanceof HibernateException he ) {\n\t\t\t\tthrow he;\n\t\t\t}\n\t\t\telse {\n\t\t\t\tthrow new HibernateException( \"Error performing work\", exception );\n\t\t\t}\n\t\t}\n\t}\n\n\tprivate static void rollBack(TransactionManager transactionManager, Exception original) {\n\t\ttry {\n\t\t\ttransactionManager.rollback();\n\t\t}\n\t\tcatch ( Exception exception ) {\n\t\t\tJTA_LOGGER.unableToRollBackIsolatedTransaction( original, exception );\n\t\t\toriginal.addSuppressed( exception );\n\t\t}\n\t}\n\n\tprivate <T> T doTheWork(WorkExecutorVisitable<T> work) {\n\t\tfinal Connection connection;\n\t\ttry {\n\t\t\t// obtain our isolated connection","sourceCodeStart":156,"sourceCodeEnd":192,"githubUrl":"https://github.com/hibernate/hibernate-orm/blob/fad1729dce015f908198d57a8d80274a30f905a5/hibernate-core/src/main/java/org/hibernate/resource/transaction/backend/jta/internal/JtaIsolationDelegate.java#L156-L192","documentation":"doInNewTransaction runs the isolated work and then commits; if callable.call() or transactionManager.commit() throws anything that is not a HibernateException, it is wrapped as 'Error performing work'. Before rethrowing, Hibernate rolls the isolated transaction back, and if that rollback fails the rollback failure is attached via addSuppressed. The real failure is therefore in getCause() (and possibly getSuppressed()), not on this wrapper.","triggerScenarios":"A RuntimeException escaping work executed inside a new JTA transaction via IsolationDelegate (transacted=true), or commit() of the isolated transaction failing with RollbackException, HeuristicMixedException, HeuristicRollbackException or SystemException.","commonSituations":"Isolated schema or generator work hitting SQL/lock errors; the isolated transaction marked rollback-only by the TM (lock timeout) and failing at commit; XA heuristic outcomes after a resource-manager crash.","solutions":["Inspect exception.getCause() and exception.getSuppressed() - the actual SQL/TM error lives there, not on the wrapper","Fix the underlying problem identified by the cause (missing object, constraint violation, lock wait)","For heuristic causes, resolve the TransactionManager transaction store and resource-manager logs","Retry once transient TM/lock conditions have cleared"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"catch (HibernateException e) {\n    Throwable cause = e.getCause() != null ? e.getCause() : e;\n    for (Throwable s : e.getSuppressed()) {\n        log.error(\"rollback of isolated transaction also failed\", s);\n    }\n    // handle 'cause' (the SQL / JTA commit error), not the wrapper\n}","preventionTips":["Treat this wrapper as a cause-carrier: always log getCause() and getSuppressed() first","Validate that schema objects used by isolated work exist before enabling the feature","Keep isolated work small so commit failures are easier to attribute"],"tags":["jta","transactions","hibernate","isolation-delegate","suppressed-exceptions"],"backgroundTag":"transaction-work-failed","analyzedSha":"fad1729dce015f908198d57a8d80274a30f905a5","analyzedAt":"2026-08-22T04:13:57.527Z","schemaVersion":2},"datasetVersion":"2026-08-22T09:17:25.309Z"}