hibernate/hibernate-orm · error · TransactionException
Unable to start isolated transaction
Error message
Unable to start isolated transaction
What it means
Thrown by JtaIsolationDelegate.doInNewTransaction when jakarta.transaction.TransactionManager.begin() throws SystemException or NotSupportedException while starting a separate transaction for Hibernate's isolated work. Isolated work is JDBC work Hibernate must run outside your current transaction (the surrounding JTA transaction is suspended first): typically schema-tool operations or isolated ID generators reached via delegateWork/delegateCallable with transacted=true. The failure is the JTA TransactionManager refusing or failing to begin that new transaction, not your own transaction failing.
Source
Thrown at hibernate-core/src/main/java/org/hibernate/resource/transaction/backend/jta/internal/JtaIsolationDelegate.java:159
JTA_LOGGER.transactionResumed( surroundingTransaction );
}
}
private Transaction suspend() throws SystemException {
final var surroundingTransaction = transactionManager.suspend();
if ( surroundingTransaction != null ) {
JTA_LOGGER.transactionSuspended( surroundingTransaction );
}
return surroundingTransaction;
}
private <T> T doInNewTransaction(HibernateCallable<T> callable, TransactionManager transactionManager) {
try {
// start the new isolated transaction
transactionManager.begin();
}
catch ( SystemException | NotSupportedException exception ) {
throw new TransactionException( "Unable to start isolated transaction", exception );
}
try {
T result = callable.call();
// if everything went ok, commit the isolated transaction
transactionManager.commit();
return result;
}
catch ( Exception exception ) { //TODO: should this be Throwable
rollBack( transactionManager, exception );
if ( exception instanceof HibernateException he ) {
throw he;
}
else {
throw new HibernateException( "Error performing work", exception );
}
}
}View on GitHub (pinned to fad1729dce)
Solutions
- Enable TRACE logging for org.hibernate.resource.transaction.backend.jta to confirm exactly which isolated operation runs when the error occurs
- Give schema tools and isolated ID generators their own non-JTA JDBC connection (separate DataSource or non-JTA connection provider) instead of the JTA one
- Verify the TransactionManager is started and supports suspend followed by begin (container TM or Narayana JBossStandaloneJTAManager)
- If timeouts trigger it, raise the JTA transaction timeout for the affected subsystem
Example fix
// before: schema management and generators run through the JTA data source <persistence-unit name="app"> <jta-data-source>java:/appDS</jta-data-source> </persistence-unit> // after: run schema export on a direct JDBC connection before bootstrap, and use pooled // optimizers so generators do not need isolated transactions per value new SchemaExport(metadata).execute(EnumSet.of(TargetType.DATABASE), exportTarget); @Id @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "order_seq") @SequenceGenerator(name = "order_seq", sequenceName = "order_seq", allocationSize = 50)
Defensive patterns
Strategy: try-catch
Validate before calling
// Verify the TransactionManager is usable before triggering isolated work
try {
int st = transactionManager.getStatus();
if ( st != jakarta.transaction.Status.STATUS_NO_TRANSACTION ) {
throw new IllegalStateException("Unexpected JTA status before isolated work: " + st);
}
}
catch (SystemException e) {
throw new IllegalStateException("TransactionManager unusable for isolated work", e);
} Try / catch
try {
return isolationDelegate.delegateWork(work, true);
}
catch (TransactionException e) {
// e.getCause() is NotSupportedException or SystemException from TransactionManager.begin()
log.error("isolated work could not start a transaction: {}", e.getCause(), e);
throw e;
} Prevention
- Do not point hbm2ddl/schema tools at a JTA-managed DataSource
- Prefer pooled sequence/table optimizers (allocationSize > 1) so generators avoid per-value isolated transactions
- Keep the TransactionManager (Narayana/Atomikos) started and healthy in SE setups
When it happens
Trigger: IsolationDelegate.delegateWork(work, true) or delegateCallable(callable, true) - e.g., a table/sequence ID generator configured for an isolated connection, or hbm2ddl/schema management running against a JTA-managed DataSource - after JtaIsolationDelegate suspended the current transaction and TransactionManager.begin() threw NotSupportedException (TM will not start another transaction) or SystemException (TM error state).
Common situations: Using the JTA DataSource for schema generation or generator value lookups; Narayana/Atomikos TransactionManager not started or in recovery; a TransactionManager that does not support suspend+begin; the isolated operation exceeding transaction timeouts.
Related errors
- Error performing work
- Error performing isolated work
- Transaction is not accessible when using JTA with JPA-compli
- Exception pulsing TransactionCoordinator
- Explicitly joining a JTA transaction requires a JTA transact
AI-assisted analysis of hibernate/hibernate-orm@fad1729dce (2026-08-22).
Data as JSON: /api/errors/2b87aa0fffde35c8.
Report an issue: GitHub.