{"record":{"id":"7f241b1182746b4f","repo":"hibernate/hibernate-orm","slug":"singlestore-does-not-support-resultsets-via-stored","errorCode":null,"errorMessage":"SingleStore does not support resultsets via stored procedures.","messagePattern":"SingleStore does not support resultsets via stored procedures\\.","errorType":"exception","errorClass":"UnsupportedOperationException","httpStatus":null,"severity":"error","filePath":"hibernate-community-dialects/src/main/java/org/hibernate/community/dialect/SingleStoreDialect.java","lineNumber":1124,"sourceCode":"\n\t@Override\n\tpublic boolean supportsCurrentTimestampSelection() {\n\t\treturn true;\n\t}\n\n\t@Override\n\tpublic boolean isCurrentTimestampSelectStringCallable() {\n\t\treturn false;\n\t}\n\n\t@Override\n\tpublic String getCurrentTimestampSelectString() {\n\t\treturn \"select now()\";\n\t}\n\n\t@Override\n\tpublic int registerResultSetOutParameter(CallableStatement statement, int col) throws SQLException {\n\t\tthrow new UnsupportedOperationException( \"SingleStore does not support resultsets via stored procedures.\" );\n\t}\n\n\t@Override\n\tpublic ResultSet getResultSet(CallableStatement ps) throws SQLException {\n\t\tboolean isResultSet = ps.execute();\n\t\twhile ( !isResultSet && ps.getUpdateCount() != -1 ) {\n\t\t\tisResultSet = ps.getMoreResults();\n\t\t}\n\t\treturn ps.getResultSet();\n\t}\n\n\t@Override\n\tpublic boolean supportsNullPrecedence() {\n\t\treturn false;\n\t}\n\n\t@Override\n\tpublic boolean supportsLobValueChangePropagation() {","sourceCodeStart":1106,"sourceCodeEnd":1142,"githubUrl":"https://github.com/hibernate/hibernate-orm/blob/fad1729dce015f908198d57a8d80274a30f905a5/hibernate-community-dialects/src/main/java/org/hibernate/community/dialect/SingleStoreDialect.java#L1106-L1142","documentation":"SingleStoreDialect.registerResultSetOutParameter() always throws because SingleStore stored procedures do not return result sets through registered output parameters (no REF_CURSOR-style registration). The companion getResultSet() shows the intended pattern: execute the callable statement and walk getMoreResults() to consume result sets directly. The exception surfaces when Hibernate binds a result-set output parameter on a CallableStatement, typically for a StoredProcedureQuery that declares a cursor OUT parameter.","triggerScenarios":"Creating a StoredProcedureQuery that registers a REF_CURSOR / result-set OUT parameter on SingleStore; native '{call ...}' queries whose outputs are registered before execution; porting Oracle/PostgreSQL procedure-call code that uses cursor parameters.","commonSituations":"Migrating an Oracle-centric persistence layer (SYS_REFCURSOR parameters everywhere) to SingleStore; reporting code that calls procedures returning cursors; database-agnostic test fixtures reused across engines.","solutions":["Consume result sets directly: call the procedure without a result-set OUT parameter and use getResultList()/getMoreResults()","Rewrite the stored procedure so its final SELECT returns the data as a direct result set, or have it write to a temp table that you query afterwards","Return computed values through ordinary OUT parameters and assemble the result in Java"],"exampleFix":"// before - Oracle-style cursor OUT parameter\nStoredProcedureQuery q = em.createStoredProcedureQuery('get_orders');\nq.registerStoredProcedureParameter(1, void.class, ParameterMode.REF_CURSOR);\nList<?> orders = q.getResultList();\n\n// after - SingleStore returns the procedure's final SELECT directly\nStoredProcedureQuery q = em.createStoredProcedureQuery('get_orders');\nList<?> orders = q.getResultList();","handlingStrategy":"validation","validationCode":"Dialect dialect = sessionFactory.getJdbcServices().getDialect();\nif (dialect instanceof SingleStoreDialect && hasRefCursorOutParam(query)) {\n    throw new UnsupportedOperationException(\n        'SingleStore procedures return result sets directly; remove REF_CURSOR out parameters');\n}\n// helper: inspect registered parameters for ParameterMode.REF_CURSOR\nstatic boolean hasRefCursorOutParam(ProcedureQuery q) {\n    return q.getParameters().stream()\n        .anyMatch(p -> p.getMode() == ParameterMode.REF_CURSOR);\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Consume SingleStore procedure results with getResultList()/getMoreResults(), never cursor OUT params","Keep Oracle-style SYS_REFCURSOR call code behind a database-specific adapter","Prefer ordinary OUT parameters plus Java-side assembly for computed values"],"tags":["hibernate","singlestore","stored-procedure","ref-cursor","callable-statement"],"backgroundTag":"stored-procedure-resultset-unsupported","analyzedSha":"fad1729dce015f908198d57a8d80274a30f905a5","analyzedAt":"2026-08-22T04:13:57.527Z","schemaVersion":2},"datasetVersion":"2026-08-22T09:17:25.309Z"}