{"record":{"id":"b2b4eceb40c76577","repo":"hibernate/hibernate-orm","slug":"entitygraphs-are-not-supported-for-native-queries","errorCode":null,"errorMessage":"EntityGraphs are not supported for native queries","messagePattern":"EntityGraphs are not supported for native queries","errorType":"exception","errorClass":"UnsupportedOperationException","httpStatus":null,"severity":"error","filePath":"hibernate-core/src/main/java/org/hibernate/query/sql/internal/NativeQueryImpl.java","lineNumber":1703,"sourceCode":"\n\t@Override\n\t@Nonnull\n\tpublic NativeQueryImplementor<R> setComment(@Nullable String comment) {\n\t\tsuper.setComment( comment );\n\t\treturn this;\n\t}\n\n\t@Override\n\t@Nonnull\n\tpublic NativeQueryImplementor<R> addQueryHint(@Nonnull String hint) {\n\t\tsuper.addQueryHint( hint );\n\t\treturn this;\n\t}\n\n\t@Override @Deprecated\n\t@Nonnull\n\tpublic NativeQueryImplementor<R> setEntityGraph(@Nonnull EntityGraph<? super R> entityGraph) {\n\t\tthrow new UnsupportedOperationException( \"EntityGraphs are not supported for native queries\" );\n\t}\n\n\t@Override @Deprecated\n\t@SuppressWarnings(\"removal\")\n\t@Nonnull\n\tpublic NativeQueryImplementor<R> setEntityGraph(@Nonnull EntityGraph<? super R> graph, @Nonnull GraphSemantic semantic) {\n\t\tthrow new UnsupportedOperationException( \"EntityGraphs are not supported for native queries\" );\n\t}\n\n\t@Override\n\tprotected void collectHints(Map<String, Object> hints) {\n\t\tsuper.collectHints( hints );\n\t\t//noinspection removal\n\t\tputIfNotNull( hints, HINT_NATIVE_LOCK_MODE, queryOptions.getLockOptions().getLockMode() );\n\t}\n\n\tprotected void applySynchronizeSpacesHint(Object value) {\n\t\tapplySynchronizeSpace( value );","sourceCodeStart":1685,"sourceCodeEnd":1721,"githubUrl":"https://github.com/hibernate/hibernate-orm/blob/fad1729dce015f908198d57a8d80274a30f905a5/hibernate-core/src/main/java/org/hibernate/query/sql/internal/NativeQueryImpl.java#L1685-L1721","documentation":"Error \"EntityGraphs are not supported for native queries\" 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":["EntityGraphs are not supported for native queries.","Remove the EntityGraph application, or use an HQL/criteria query."],"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"}