{"record":{"id":"19932387147b4c20","repo":"hibernate/hibernate-orm","slug":"procedurecall-cannot-be-treated-as-a-mutation-quer","errorCode":null,"errorMessage":"ProcedureCall cannot be treated as a mutation query","messagePattern":"ProcedureCall cannot be treated as a mutation query","errorType":"exception","errorClass":"UnsupportedOperationException","httpStatus":null,"severity":"error","filePath":"hibernate-core/src/main/java/org/hibernate/procedure/internal/NamedCallableQueryMementoImpl.java","lineNumber":158,"sourceCode":"\t\treturn new ProcedureCallImpl<>( session, this, resultSetMappingNames );\n\t}\n\n\t@Nonnull\n\t@Override\n\tpublic ProcedureCallImplementor toQuery(@Nonnull SharedSessionContractImplementor session) {\n\t\treturn makeProcedureCall( session );\n\t}\n\n\t@Nonnull\n\t@Override\n\tpublic <T> ProcedureCallImplementor<T> toQuery(@Nonnull SharedSessionContractImplementor session, @Nullable Class<T> javaType) {\n\t\treturn makeProcedureCall( session );\n\t}\n\n\t@Nonnull\n\t@Override\n\tpublic MutationQueryImplementor<Object> toMutationQuery(@Nonnull SharedSessionContractImplementor session) {\n\t\tthrow new UnsupportedOperationException( \"ProcedureCall cannot be treated as a mutation query\" );\n\t}\n\n\t@Nonnull\n\t@Override\n\tpublic <T> MutationQueryImplementor<T> toMutationQuery(@Nonnull SharedSessionContractImplementor session, @Nullable Class<T> targetType) {\n\t\tthrow new UnsupportedOperationException( \"ProcedureCall cannot be treated as a mutation query\" );\n\t}\n\n\t@Nonnull\n\t@Override\n\tpublic SelectionQueryImplementor<Object> toSelectionQuery(@Nonnull SharedSessionContractImplementor session) {\n\t\tthrow new UnsupportedOperationException( \"ProcedureCall cannot be treated as a selection query\" );\n\t}\n\n\t@Nonnull\n\t@Override\n\tpublic <T> SelectionQueryImplementor<T> toSelectionQuery(@Nonnull SharedSessionContractImplementor session, @Nullable Class<T> javaType) {\n\t\tthrow new UnsupportedOperationException( \"ProcedureCall cannot be treated as a selection query\" );","sourceCodeStart":140,"sourceCodeEnd":176,"githubUrl":"https://github.com/hibernate/hibernate-orm/blob/fad1729dce015f908198d57a8d80274a30f905a5/hibernate-core/src/main/java/org/hibernate/procedure/internal/NamedCallableQueryMementoImpl.java#L140-L176","documentation":"Error \"ProcedureCall cannot be treated as a mutation query\" thrown in hibernate/hibernate-orm.","triggerScenarios":"An API operation is invoked on an object that does not support it.","commonSituations":"Using query/procedure/proxy APIs beyond their supported feature set (e.g. scrolling, locking, unwrapping a procedure call).","solutions":["Do not cast a ProcedureCall to MutationQuery; use execute()/getOutputs() on the ProcedureCall API.","If a mutation is needed, use a HQL update statement instead of a procedure call."],"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"}