quarkusio/quarkus · error · UnsupportedOperationException
Stateless operations not supported
Error message
Stateless operations not supported
What it means
ManagedBlockingOperations wraps a managed (persistence-context) blocking Hibernate Session. getStatelessSession(entityClass) would need to hand out a StatelessSession, which the managed delegate cannot provide (the source even marks it with a FIXME). Because managed operations objects never expose stateless sessions, the method throws UnsupportedOperationException.
Source
Thrown at extensions/data/hibernate/runtime/src/main/java/io/quarkus/data/hibernate/runtime/orm/ManagedBlockingOperations.java:32
import io.quarkus.data.hibernate.runtime.spi.PanacheBlockingOperations;
public class ManagedBlockingOperations implements PanacheBlockingOperations {
public final static ManagedBlockingOperations INSTANCE = new ManagedBlockingOperations();
private final static ManagedBlockingJpaOperations DELEGATE = new ManagedBlockingJpaOperations();
private ManagedBlockingOperations() {
}
@Override
public Session getSession(Class<?> entityClass) {
return DELEGATE.getSession(entityClass);
}
@Override
public StatelessSession getStatelessSession(Class<?> entityClass) {
// FIXME: this is wrong
throw new UnsupportedOperationException("Stateless operations not supported");
}
@Override
public Void insert(Object entity) {
throw new UnsupportedOperationException("Stateless operations not supported");
}
@Override
public Void persist(Object entity) {
DELEGATE.persist(entity);
return null;
}
@Override
public Void persistAndFlush(Object entity) {
DELEGATE.persist(entity);
DELEGATE.flush(entity);
return null;View on GitHub (pinned to e1c734241f)
Solutions
- Obtain the StatelessSession directly from the session factory (openStatelessSession) instead of via the managed wrapper
- Use the dedicated stateless operations object for stateless work (insert/upsert/delete)
- Restructure code so managed and stateless operations use separate, explicitly obtained handles
- Track upstream Quarkus updates in case the FIXME is resolved and stateless support is added
Example fix
// before StatelessSession sss = managedOps.getStatelessSession(User.class); // after StatelessSession sss = sessionFactory.openStatelessSession();
Defensive patterns
Strategy: try-catch
Validate before calling
// do not request a stateless session from a managed wrapper // obtain it from the factory instead: // StatelessSession sss = sessionFactory.openStatelessSession();
Try / catch
StatelessSession sss;
try {
sss = managedOps.getStatelessSession(User.class);
} catch (UnsupportedOperationException e) {
sss = sessionFactory.openStatelessSession();
} Prevention
- Get StatelessSession only from the SessionFactory (openStatelessSession)
- Keep stateless batch code on its own handle, separate from managed sessions
- Watch the upstream FIXME — do not rely on this method existing
When it happens
Trigger: Calling getStatelessSession(SomeEntity.class) on a managed blocking operations/session wrapper, e.g. generic code that obtains either a managed or stateless view depending on context.
Common situations: Utility code abstracting over both managed and stateless access paths; developers trying to mix stateless batch operations into a managed session handle; version drift where the managed wrapper's API surface grew but stateless support was not implemented.
Related errors
- Stateless operations not supported
- Managed operations not supported
- Managed operations not supported
- Limiting to 0 values is not supported
- ${exceptionMsgSupplier.get()} (blocking annotations conflict
AI-assisted analysis of quarkusio/quarkus@e1c734241f (2026-09-05).
Data as JSON: /api/errors/6d91fd154d60bcd1.
Report an issue: GitHub.