{"record":{"id":"66886ba6272f9157","repo":"hibernate/hibernate-orm","slug":"not-a-mutation-query","errorCode":null,"errorMessage":"Not a mutation query","messagePattern":"Not a mutation query","errorType":"exception","errorClass":"IllegalMutationQueryException","httpStatus":null,"severity":"error","filePath":"hibernate-core/src/main/java/org/hibernate/query/internal/SelectionQueryImpl.java","lineNumber":1630,"sourceCode":"\n\t@Override @Deprecated @SuppressWarnings(\"deprecation\")\n\t@Nonnull\n\tpublic SelectionQueryImplementor<R> setParameter(int position, @Nullable Calendar value, @Nonnull TemporalType temporalType) {\n\t\tsuper.setParameter( position, value, temporalType );\n\t\treturn this;\n\t}\n\n\t@Override @Deprecated @SuppressWarnings(\"deprecation\")\n\t@Nonnull\n\tpublic SelectionQueryImplementor<R> setParameter(int position, @Nullable Date value, @Nonnull TemporalType temporalType) {\n\t\tsuper.setParameter( position, value, temporalType );\n\t\treturn this;\n\t}\n\n\t@Override\n\t@Nonnull\n\tpublic MutationQueryImplementor<R> asMutationQuery() {\n\t\tthrow new IllegalMutationQueryException( \"Not a mutation query\", getQueryString() );\n\t}\n}\n","sourceCodeStart":1612,"sourceCodeEnd":1633,"githubUrl":"https://github.com/hibernate/hibernate-orm/blob/fad1729dce015f908198d57a8d80274a30f905a5/hibernate-core/src/main/java/org/hibernate/query/internal/SelectionQueryImpl.java#L1612-L1633","documentation":"Error \"Not a mutation query\" thrown in hibernate/hibernate-orm.","triggerScenarios":"A query is treated as the wrong kind (selection vs mutation): Not a mutation query","commonSituations":"Unwrapping/casting a SelectionQuery to MutationQuery (or the reverse) when the underlying statement type does not match.","solutions":["The query is not a mutation query. Only update/delete/insert queries can be used where a MutationQuery is expected."],"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"}