{"record":{"id":"eefcee15bf294c91","repo":"hibernate/hibernate-orm","slug":"storedprocedurequery-is-closed","errorCode":null,"errorMessage":"StoredProcedureQuery is closed","messagePattern":"StoredProcedureQuery is closed","errorType":"exception","errorClass":"IllegalStateException","httpStatus":null,"severity":"error","filePath":"hibernate-core/src/main/java/org/hibernate/procedure/internal/ProcedureCallImpl.java","lineNumber":1048,"sourceCode":"\t\tcheckNotClosed();\n\t\tif ( outputs == null ) {\n\t\t\toutputs = buildOutputs();\n\t\t}\n\t\treturn outputs;\n\t}\n\n\t@Override\n\tpublic void close() {\n\t\tcheckNotClosed();\n\t\tclosed = true;\n\t\tif ( outputs != null ) {\n\t\t\toutputs.release();\n\t\t}\n\t}\n\n\tprivate void checkNotClosed() {\n\t\tif ( closed ) {\n\t\t\tthrow new IllegalStateException( \"StoredProcedureQuery is closed\" );\n\t\t}\n\t}\n\n\tprivate OutputsImpl buildOutputs() {\n\t\t// todo : going to need a very specialized Loader for this.\n\t\t// or, might be a good time to look at splitting Loader up into:\n\t\t//\t\t1) building statement objects\n\t\t//\t\t2) executing statement objects\n\t\t//\t\t3) processing result sets\n\n\t\t// for now assume there are no resultClasses nor mappings defined\n\t\t// \tTOTAL PROOF-OF-CONCEPT!!!!!!\n\n\t\t// todo : how to identify calls which should be in the form `{? = call procName...}` ??? (note leading param marker)\n\t\t// \t\tmore than likely this will need to be a method on the native API.  I can see this as a trigger to\n\t\t//\t\tboth: (1) add the `? = ` part and also (2) register a REFCURSOR parameter for DBs (Oracle, PGSQL) that\n\t\t//\t\tneed it.\n","sourceCodeStart":1030,"sourceCodeEnd":1066,"githubUrl":"https://github.com/hibernate/hibernate-orm/blob/fad1729dce015f908198d57a8d80274a30f905a5/hibernate-core/src/main/java/org/hibernate/procedure/internal/ProcedureCallImpl.java#L1030-L1066","documentation":"Error \"StoredProcedureQuery is closed\" thrown in hibernate/hibernate-orm.","triggerScenarios":"A runtime precondition of the Hibernate API is violated.","commonSituations":"Occurs when application code or configuration does not satisfy the documented contract of the API being called.","solutions":["Call the StoredProcedureQuery methods before close() is invoked.","Guard usage with isOpen() and reopen a new query from the EntityManager if needed."],"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"}