quarkusio/quarkus · error · IllegalStateException
Not supported for JTA entity managers
Error message
Not supported for JTA entity managers
What it means
Quarkus Hibernate ORM uses JTA transactions, so the JPA API getTransaction() (Resource-local transactions) is unsupported and throws IllegalStateException with 'Not supported for JTA entity managers'.
Source
Thrown at extensions/hibernate-orm/runtime/src/main/java/io/quarkus/hibernate/orm/runtime/session/TransactionScopedStatelessSession.java:320
}
}
@Override
public void insertMultiple(List<?> entities) {
checkBlocking();
try (SessionResult emr = acquireSession()) {
emr.statelessSession.insertMultiple(entities);
}
}
@Override
public boolean isOpen() {
return true;
}
@Override
public Transaction getTransaction() {
throw new IllegalStateException("Not supported for JTA entity managers");
}
@Override
public HibernateCriteriaBuilder getCriteriaBuilder() {
checkBlocking();
try (SessionResult emr = acquireSession()) {
return emr.statelessSession.getCriteriaBuilder();
}
}
@Deprecated
@Override
public void update(Object object) {
checkBlocking();
try (SessionResult emr = acquireSession()) {
emr.statelessSession.update(object);
}
}View on GitHub (pinned to e1c734241f)
Solutions
- Use @Transactional for declarative transaction management
- Inject jakarta.transaction.UserTransaction for programmatic begin/commit/rollback
- Use Session.isJoinedToTransaction() or the CDI TransactionManager to inspect transaction state instead
Example fix
// before
statelessSession.getTransaction().begin(); // throws
// after
@Inject UserTransaction tx;
public void doWork() throws Exception {
tx.begin();
statelessSession.insert(entity);
tx.commit();
} Defensive patterns
Strategy: type-guard
Validate before calling
// Quarkus uses JTA: never call getTransaction(); inspect via boolean inTx = statelessSession.isJoinedToTransaction();
Type guard
boolean usesResourceLocalApi(Session s) {
try { s.getTransaction(); return false; } catch (IllegalStateException e) { return true; }
} Try / catch
try {
session.getTransaction().begin();
} catch (IllegalStateException e) {
if (e.getMessage().contains("JTA")) {
tx.begin(); // UserTransaction instead
} else { throw e; }
} Prevention
- Use @Transactional or UserTransaction, never getTransaction() in Quarkus
- Search codebase for getTransaction() when migrating from Spring/plain Hibernate
- Use isJoinedToTransaction() to inspect transaction state
When it happens
Trigger: Calling session.getTransaction() (or entityManager.getTransaction()) on a transaction-scoped session, typically to call begin()/commit()/rollback() manually.
Common situations: Porting Spring or plain-Hibernate code that manually calls getTransaction().begin()/commit(); copying resource-local examples into a Quarkus app; trying to check transaction status via getTransaction().isActive().
Related errors
- Transaction is not active, consider adding @Transactional to
- Not supported for JTA entity managers
- Cannot use the StatelessSession because no transaction is ac
- Transaction is not active, consider adding @Transactional to
- Methods that are annotated with JPA Listener annotations sho
AI-assisted analysis of quarkusio/quarkus@e1c734241f (2026-09-05).
Data as JSON: /api/errors/7ae2f31799b28aee.
Report an issue: GitHub.