{"record":{"id":"7d80d791d0166508","repo":"hibernate/hibernate-orm","slug":"lock-timeout-not-supported-for-native-query","errorCode":null,"errorMessage":"Lock timeout not supported for native query","messagePattern":"Lock timeout not supported for native query","errorType":"exception","errorClass":"IllegalStateException","httpStatus":null,"severity":"error","filePath":"hibernate-core/src/main/java/org/hibernate/query/sql/internal/NativeQueryImpl.java","lineNumber":780,"sourceCode":"\n\t@Override\n\t@Nonnull\n\tpublic NativeQueryImplementor<R> setHibernateLockMode(@Nonnull LockMode lockMode) {\n\t\t//noinspection removal\n\t\tqueryOptions.getLockOptions().setLockMode( lockMode );\n\t\treturn this;\n\t}\n\n\t@Override\n\t@Nullable\n\tpublic Timeout getLockTimeout() {\n\t\treturn null;\n\t}\n\n\t@Override\n\t@Nonnull\n\tpublic NativeQueryImplementor<R> setLockTimeout(@Nullable Timeout lockTimeout) {\n\t\tthrow new IllegalStateException( \"Lock timeout not supported for native query\" );\n\t}\n\n\t@Override\n\t@Nonnull\n\tpublic NativeQueryImplementor<R> setLockScope(@Nonnull PessimisticLockScope lockScope) {\n\t\t//noinspection removal\n\t\tqueryOptions.getLockOptions().setLockScope( lockScope );\n\t\treturn this;\n\t}\n\n\t@Override @Deprecated\n\t@SuppressWarnings(\"removal\")\n\t@Nonnull\n\tpublic NativeQueryImplementor<R> disableFetchProfile(@Nonnull String profileName) {\n\t\tqueryOptions.disableFetchProfile( profileName );\n\t\treturn this;\n\t}\n","sourceCodeStart":762,"sourceCodeEnd":798,"githubUrl":"https://github.com/hibernate/hibernate-orm/blob/fad1729dce015f908198d57a8d80274a30f905a5/hibernate-core/src/main/java/org/hibernate/query/sql/internal/NativeQueryImpl.java#L762-L798","documentation":"Error \"Lock timeout not supported for native query\" thrown in hibernate/hibernate-orm.","triggerScenarios":"An API operation is invoked on a query object that does not support it.","commonSituations":"Calling query hint, locking, pagination, conversion, or mutation APIs on a query kind (native vs HQL, select vs mutation) that does not implement them.","solutions":["Lock timeouts are not supported on native queries.","Remove the lock-timeout hint or set the timeout at the JDBC/transaction level."],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"fad1729dce015f908198d57a8d80274a30f905a5","analyzedAt":"2026-08-22T04:13:57.527Z","schemaVersion":2},"datasetVersion":"2026-08-22T09:17:25.309Z"}