{"record":{"id":"bdf5cd6dc6f83754","repo":"hibernate/hibernate-orm","slug":"fetch-size-is-not-relevant-for-non-select-nativequ","errorCode":null,"errorMessage":"Fetch-size is not relevant for non-select NativeQuery","messagePattern":"Fetch-size 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":905,"sourceCode":"\t@Override\n\t@Nullable\n\tpublic PessimisticLockScope getLockScope() {\n\t\t//noinspection removal\n\t\treturn queryOptions.getLockOptions().getLockScope();\n\t}\n\n\t@Override\n\tprotected void applyReadOnlyHint(String hintName, Object value) {\n\t\tif ( isNotSelectForSure() ) {\n\t\t\tthrow new IllegalArgumentException( \"Read-only is not relevant for non-select NativeQuery\" );\n\t\t}\n\t\tsuper.applyReadOnlyHint( hintName, value );\n\t}\n\n\t@Override\n\tprotected void applyFetchSizeHint(String hintName, Object value) {\n\t\tif ( isNotSelectForSure() ) {\n\t\t\tthrow new IllegalArgumentException( \"Fetch-size is not relevant for non-select NativeQuery\" );\n\t\t}\n\t\tsuper.applyFetchSizeHint( hintName, value );\n\t}\n\n\t@Override\n\tprotected void applyResultCachingHint(String hintName, Object value) {\n\t\tif ( isNotSelectForSure() ) {\n\t\t\tthrow new IllegalArgumentException( \"Result-caching is not relevant for non-select NativeQuery\" );\n\t\t}\n\t\tsuper.applyResultCachingHint( hintName, value );\n\t}\n\n\t@Override\n\tprotected void applyResultCacheModeHint(String hintName, Object value) {\n\t\tif ( isNotSelectForSure() ) {\n\t\t\tthrow new IllegalArgumentException( \"Result-caching is not relevant for non-select NativeQuery\" );\n\t\t}\n\t\tsuper.applyResultCacheModeHint( hintName, value );","sourceCodeStart":887,"sourceCodeEnd":923,"githubUrl":"https://github.com/hibernate/hibernate-orm/blob/fad1729dce015f908198d57a8d80274a30f905a5/hibernate-core/src/main/java/org/hibernate/query/sql/internal/NativeQueryImpl.java#L887-L923","documentation":"Error \"Fetch-size 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":["Fetch-size only applies to selecting queries; the query is a non-select native query.","Remove the setFetchSize call 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"}