{"record":{"id":"3d2a36f6bd25e5e4","repo":"hibernate/hibernate-orm","slug":"attempting-to-get-a-result-list-from-a-mutation-qu","errorCode":null,"errorMessage":"Attempting to get a result list from a mutation query","messagePattern":"Attempting to get a result list from a mutation query","errorType":"exception","errorClass":"IllegalStateException","httpStatus":null,"severity":"error","filePath":"hibernate-core/src/main/java/org/hibernate/query/internal/MutationQueryImpl.java","lineNumber":397,"sourceCode":"\t\t}\n\n\t\treturn false;\n\t}\n\n\tprotected boolean isSimpleValuesInsert(SqmInsertStatement<?> sqmInsert, EntityPersister entityDescriptor) {\n\t\t// Simple means that we can translate the statement to a single plain insert\n\t\treturn sqmInsert instanceof SqmInsertValuesStatement\n\t\t\t// An insert is only simple if no SqmMultiTableMutation strategy is available,\n\t\t\t// as the presence of it means the entity has multiple tables involved,\n\t\t\t// in which case we currently need to use the MultiTableInsertQueryPlan\n\t\t\t&& entityDescriptor.getSqmMultiTableMutationStrategy() == null;\n\t}\n\n\t@Override @SuppressWarnings(\"deprecation\")\n\t@Nonnull\n\tpublic List<T> getResultList() {\n\t\tfinal var message = \"Attempting to get a result list from a mutation query\";\n\t\tthrow new IllegalStateException( message, new IllegalSelectQueryException( message, hql ) );\n\t}\n\n\t@Override @SuppressWarnings(\"deprecation\")\n\t@Nonnull\n\tpublic ScrollableResults<T> scroll(@Nonnull ScrollMode scrollMode) {\n\t\tfinal var message = \"Attempting to scroll list from a mutation query\";\n\t\tthrow new IllegalStateException( message, new IllegalSelectQueryException( message, hql ) );\n\t}\n\n\n\t// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n\t// Options\n\n\t@Override\n\tprotected void verifySelectionOption(String name) {\n\t\tthrow selectionOption( name );\n\t}\n","sourceCodeStart":379,"sourceCodeEnd":415,"githubUrl":"https://github.com/hibernate/hibernate-orm/blob/fad1729dce015f908198d57a8d80274a30f905a5/hibernate-core/src/main/java/org/hibernate/query/internal/MutationQueryImpl.java#L379-L415","documentation":"Error \"Attempting to get a result list from a mutation query\" thrown in hibernate/hibernate-orm.","triggerScenarios":"A selection-only operation is invoked on a mutation (insert/update/delete) query: Attempting to get a result list from a mutation query","commonSituations":"Calling getResultList()/scroll()/unwrap(SelectionQuery) on a Query created from an update/delete/insert HQL statement, or vice versa.","solutions":["Mutation queries do not produce result lists. Use executeUpdate() for update/delete/insert statements."],"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"}