{"record":{"id":"11404c2ab59836cc","repo":"hibernate/hibernate-orm","slug":"attempting-to-scroll-list-from-a-mutation-query","errorCode":null,"errorMessage":"Attempting to scroll list from a mutation query","messagePattern":"Attempting to scroll 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":404,"sourceCode":"\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\n\tprivate IllegalStateException selectionOption(String name) {\n\t\tfinal var msg = name + \" is not supported for mutation queries\";\n\t\t// JPA calls for ISE, but use that to wrap our more meaningful IllegalSelectQueryException\n\t\treturn new IllegalStateException( msg, new IllegalSelectQueryException( msg, hql ) );\n\t}\n\n\t@Override","sourceCodeStart":386,"sourceCodeEnd":422,"githubUrl":"https://github.com/hibernate/hibernate-orm/blob/fad1729dce015f908198d57a8d80274a30f905a5/hibernate-core/src/main/java/org/hibernate/query/internal/MutationQueryImpl.java#L386-L422","documentation":"Error \"Attempting to scroll 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 scroll 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":["Scrolling is not available on a mutation query. Use executeUpdate(), or run a selection query to scroll results."],"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"}