{"record":{"id":"14ca49cf20844077","repo":"hibernate/hibernate-orm","slug":"dialect-dialect-getclass-getname-not","errorCode":null,"errorMessage":"Dialect [\" + dialect.getClass().getName() + \"] not known to support REF_CURSOR parameters","messagePattern":"Dialect \\[\" \\+ dialect\\.getClass\\(\\)\\.getName\\(\\) \\+ \"\\] not known to support REF_CURSOR parameters","errorType":"exception","errorClass":"QueryException","httpStatus":null,"severity":"error","filePath":"hibernate-core/src/main/java/org/hibernate/procedure/internal/StandardCallableStatementSupport.java","lineNumber":115,"sourceCode":"\t\t\t}\n\t\t}\n\n\t\tbuffer.append( \")}\" );\n\n\t\tbuilder.setCallableName( buffer.toString() );\n\t\treturn builder.buildJdbcCall();\n\t}\n\n\tprotected void appendNameParameter(\n\t\t\tStringBuilder buffer,\n\t\t\tProcedureParameterImplementor<?> parameter,\n\t\t\tJdbcCallParameterRegistration registration) {\n\t\tbuffer.append( '?' );\n\t}\n\n\tprivate void verifyRefCursorSupport(Dialect dialect) {\n\t\tif ( ! supportsRefCursors ) {\n\t\t\tthrow new QueryException( \"Dialect [\" + dialect.getClass().getName() + \"] not known to support REF_CURSOR parameters\" );\n\t\t}\n\t}\n}\n","sourceCodeStart":97,"sourceCodeEnd":119,"githubUrl":"https://github.com/hibernate/hibernate-orm/blob/fad1729dce015f908198d57a8d80274a30f905a5/hibernate-core/src/main/java/org/hibernate/procedure/internal/StandardCallableStatementSupport.java#L97-L119","documentation":"StandardCallableStatementSupport captures the dialect's REF_CURSOR capability (Dialect#supportsRefCursors()) when it is created, and verifyRefCursorSupport throws QueryException 'Dialect [...] not known to support REF_CURSOR parameters' when a ParameterMode.REF_CURSOR registration is used despite that flag being false. The check fails fast instead of rendering a JDBC call the driver cannot execute.","triggerScenarios":"call.registerParameter(1, void.class, ParameterMode.REF_CURSOR) or Jakarta registerStoredProcedureParameter(..., ParameterMode.REF_CURSOR) on dialects where supportsRefCursors() returns false — SQL Server, Sybase ASE, H2, older MySQL/MariaDB dialects.","commonSituations":"Porting Oracle/PostgreSQL REF_CURSOR procedure code to SQL Server or Sybase; integration tests running against H2 while production uses Oracle; upgrading Hibernate where dialect capability detection changed; using a generic dialect instead of the versioned one.","solutions":["Remove the REF_CURSOR registration and consume the implicit result sets: outputs.getResultList() / getResults() or StoredProcedureQuery.getResultList()","Guard with dialect.supportsRefCursors() and branch to a dialect-specific call path","On databases without REF_CURSOR parameters, rewrite the procedure to SELECT the rows back and read them as returned result sets","Use the correct versioned dialect (OracleDialect, PostgreSQLDialect, ...) so capability detection matches the server"],"exampleFix":"// before\ncall.registerParameter(1, void.class, ParameterMode.REF_CURSOR);\n\n// after (SQL Server / Sybase: implicit result sets)\nStoredProcedureQuery q = em.createStoredProcedureQuery(\"list_orders\");\nq.execute();\nList<?> orders = q.getResultList();","handlingStrategy":"validation","validationCode":"Dialect dialect = session.getJdbcServices().getJdbcEnvironment().getDialect();\nif (dialect.supportsRefCursors()) {\n    call.registerParameter(1, void.class, ParameterMode.REF_CURSOR);\n} else {\n    // no REF_CURSOR support: consume implicit result sets via getResults()/getResultList()\n}","typeGuard":null,"tryCatchPattern":"try {\n    call.execute();\n} catch (org.hibernate.QueryException e) {\n    if (e.getMessage().contains(\"REF_CURSOR\")) {\n        // dialect lacks REF_CURSOR support: drop the cursor registration and read implicit result sets\n    }\n}","preventionTips":["Check dialect.supportsRefCursors() before registering REF_CURSOR parameters","Prefer implicit result sets over cursor parameters for portable procedure code","Run procedure integration tests against the same database as production, not only H2","Use the versioned dialect for your database so capability flags are correct"],"tags":["hibernate","stored-procedure","ref-cursor","dialect","jdbc"],"backgroundTag":"ref-cursor-unsupported","analyzedSha":"fad1729dce015f908198d57a8d80274a30f905a5","analyzedAt":"2026-08-22T04:13:57.527Z","schemaVersion":2},"datasetVersion":"2026-08-22T09:17:25.309Z"}