{"record":{"id":"8583ad0648231fc9","repo":"hibernate/hibernate-orm","slug":"locking-is-not-relevant-for-non-select-nativequery","errorCode":null,"errorMessage":"Locking is not relevant for non-select NativeQuery","messagePattern":"Locking is not relevant for non-select NativeQuery","errorType":"exception","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"hibernate-core/src/main/java/org/hibernate/query/sql/internal/NativeQueryImpl.java","lineNumber":966,"sourceCode":"\t}\n\n\t@Override\n\tprotected void applyEntityGraphHint(GraphSemantic graphSemantic, Object value, String hintName) {\n\t\tthrow new HibernateException( \"A native SQL query cannot use EntityGraphs\" );\n\t}\n\n\t@Override\n\tprotected void applyEnabledFetchProfileHint(String hintName, Object value) {\n\t\tif ( isNotSelectForSure() ) {\n\t\t\tthrow new IllegalArgumentException( \"Fetch-profile is not relevant for non-select NativeQuery\" );\n\t\t}\n\t\tsuper.applyEnabledFetchProfileHint( hintName, value );\n\t}\n\n\t@Override\n\tprotected void applyLockTimeoutHint(String hintName, Object value) {\n\t\tif ( isNotSelectForSure() ) {\n\t\t\tthrow new IllegalArgumentException( \"Locking is not relevant for non-select NativeQuery\" );\n\t\t}\n\t\tsuper.applyLockTimeoutHint( hintName, value );\n\t\tsuper.applyLockTimeoutHint( hintName, value );\n\t}\n\n\t@Override\n\tprotected void applyFollowOnStrategyHint(Object value) {\n\t\tif ( isNotSelectForSure() ) {\n\t\t\tthrow new IllegalArgumentException( \"Locking is not relevant for non-select NativeQuery\" );\n\t\t}\n\t\tsuper.applyFollowOnStrategyHint( value );\n\t}\n\n\t@Override\n\t@Nonnull\n\tpublic <T> NativeQueryImplementor<T> setTupleTransformer(@Nonnull TupleTransformer<T> transformer) {\n\t\terrorIfNotSelectForSure();\n\t\tqueryOptions.setTupleTransformer( transformer );","sourceCodeStart":948,"sourceCodeEnd":984,"githubUrl":"https://github.com/hibernate/hibernate-orm/blob/fad1729dce015f908198d57a8d80274a30f905a5/hibernate-core/src/main/java/org/hibernate/query/sql/internal/NativeQueryImpl.java#L948-L984","documentation":"Error \"Locking is not relevant for non-select NativeQuery\" 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":["Locking options only apply to selecting queries; the query is a non-select native query.","Remove lock-related options for mutation native queries."],"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"}