hibernate/hibernate-orm · error · IllegalStateException
Lock timeout not supported for native query
Error message
Lock timeout not supported for native query
What it means
Error "Lock timeout not supported for native query" thrown in hibernate/hibernate-orm.
Source
Thrown at hibernate-core/src/main/java/org/hibernate/query/sql/internal/NativeQueryImpl.java:780
@Override
@Nonnull
public NativeQueryImplementor<R> setHibernateLockMode(@Nonnull LockMode lockMode) {
//noinspection removal
queryOptions.getLockOptions().setLockMode( lockMode );
return this;
}
@Override
@Nullable
public Timeout getLockTimeout() {
return null;
}
@Override
@Nonnull
public NativeQueryImplementor<R> setLockTimeout(@Nullable Timeout lockTimeout) {
throw new IllegalStateException( "Lock timeout not supported for native query" );
}
@Override
@Nonnull
public NativeQueryImplementor<R> setLockScope(@Nonnull PessimisticLockScope lockScope) {
//noinspection removal
queryOptions.getLockOptions().setLockScope( lockScope );
return this;
}
@Override @Deprecated
@SuppressWarnings("removal")
@Nonnull
public NativeQueryImplementor<R> disableFetchProfile(@Nonnull String profileName) {
queryOptions.disableFetchProfile( profileName );
return this;
}
View on GitHub (pinned to fad1729dce)
Solutions
- Lock timeouts are not supported on native queries.
- Remove the lock-timeout hint or set the timeout at the JDBC/transaction level.
When it happens
Trigger: An API operation is invoked on a query object that does not support it.
Common situations: Calling query hint, locking, pagination, conversion, or mutation APIs on a query kind (native vs HQL, select vs mutation) that does not implement them.
Understand the failure class
- Timeouts: ETIMEDOUT, deadlines, and hung requests — what actually expires when a request times out.
AI-assisted analysis of hibernate/hibernate-orm@fad1729dce (2026-08-22).
Data as JSON: /api/errors/7d80d791d0166508.
Report an issue: GitHub.