hibernate/hibernate-orm · error · UnsupportedOperationException

SingleStore does not support resultsets via stored procedure

Error message

SingleStore does not support resultsets via stored procedures.

What it means

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.

Source

Thrown at hibernate-community-dialects/src/main/java/org/hibernate/community/dialect/SingleStoreDialect.java:1124

	@Override
	public boolean supportsCurrentTimestampSelection() {
		return true;
	}

	@Override
	public boolean isCurrentTimestampSelectStringCallable() {
		return false;
	}

	@Override
	public String getCurrentTimestampSelectString() {
		return "select now()";
	}

	@Override
	public int registerResultSetOutParameter(CallableStatement statement, int col) throws SQLException {
		throw new UnsupportedOperationException( "SingleStore does not support resultsets via stored procedures." );
	}

	@Override
	public ResultSet getResultSet(CallableStatement ps) throws SQLException {
		boolean isResultSet = ps.execute();
		while ( !isResultSet && ps.getUpdateCount() != -1 ) {
			isResultSet = ps.getMoreResults();
		}
		return ps.getResultSet();
	}

	@Override
	public boolean supportsNullPrecedence() {
		return false;
	}

	@Override
	public boolean supportsLobValueChangePropagation() {

View on GitHub (pinned to fad1729dce)

Solutions

  1. Consume result sets directly: call the procedure without a result-set OUT parameter and use getResultList()/getMoreResults()
  2. 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
  3. Return computed values through ordinary OUT parameters and assemble the result in Java

Example fix

// before - Oracle-style cursor OUT parameter
StoredProcedureQuery q = em.createStoredProcedureQuery('get_orders');
q.registerStoredProcedureParameter(1, void.class, ParameterMode.REF_CURSOR);
List<?> orders = q.getResultList();

// after - SingleStore returns the procedure's final SELECT directly
StoredProcedureQuery q = em.createStoredProcedureQuery('get_orders');
List<?> orders = q.getResultList();
Defensive patterns

Strategy: validation

Validate before calling

Dialect dialect = sessionFactory.getJdbcServices().getDialect();
if (dialect instanceof SingleStoreDialect && hasRefCursorOutParam(query)) {
    throw new UnsupportedOperationException(
        'SingleStore procedures return result sets directly; remove REF_CURSOR out parameters');
}
// helper: inspect registered parameters for ParameterMode.REF_CURSOR
static boolean hasRefCursorOutParam(ProcedureQuery q) {
    return q.getParameters().stream()
        .anyMatch(p -> p.getMode() == ParameterMode.REF_CURSOR);
}

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Related errors


AI-assisted analysis of hibernate/hibernate-orm@fad1729dce (2026-08-22). Data as JSON: /api/errors/7f241b1182746b4f. Report an issue: GitHub.