apache/shardingsphere · error · SQLFeatureNotSupportedException

getObject with map

Error message

getObject with map

What it means

getObject(String, Map<String, Class<?>>) is the legacy JDBC custom-type-map accessor for structured/distinct types. ShardingSphere's federation ResultSet does not implement type-map resolution, so the final method throws SQLFeatureNotSupportedException('getObject with map') unconditionally.

Source

Thrown at kernel/sql-federation/core/src/main/java/org/apache/shardingsphere/sqlfederation/resultset/AbstractUnsupportedOperationSQLFederationResultSet.java:205

    
    @Override
    public final RowId getRowId(final String columnLabel) throws SQLException {
        throw new SQLFeatureNotSupportedException("getRowId");
    }
    
    @Override
    public <T> T getObject(final int columnIndex, final Class<T> type) throws SQLException {
        throw new SQLFeatureNotSupportedException("getObject with type");
    }
    
    @Override
    public <T> T getObject(final String columnLabel, final Class<T> type) throws SQLException {
        throw new SQLFeatureNotSupportedException("getObject with type");
    }
    
    @Override
    public final Object getObject(final String columnLabel, final Map<String, Class<?>> map) throws SQLException {
        throw new SQLFeatureNotSupportedException("getObject with map");
    }
    
    @Override
    public final Object getObject(final int columnIndex, final Map<String, Class<?>> map) throws SQLException {
        throw new SQLFeatureNotSupportedException("getObject with map");
    }
}

View on GitHub (pinned to e952770a21)

Solutions

  1. Use plain getObject(columnLabel) and handle the returned value (often a String or driver STRUCT) manually.
  2. Move structured/object types out of the schema into ordinary relational columns.
  3. Route statements that need type-map resolution outside the federation engine to the native driver.
  4. Pass null instead of a map if the driver accepts it, letting default mapping apply — but note federation still rejects the two-arg form, so prefer the single-arg call.

Example fix

// before
Object struct = resultSet.getObject("address", typeMap);

// after
Object struct = resultSet.getObject("address");
Defensive patterns

Strategy: fallback

Try / catch

try { value = rs.getObject("address", typeMap); } catch (SQLFeatureNotSupportedException e) { value = rs.getObject("address"); }

Prevention

When it happens

Trigger: Calling ResultSet.getObject(columnLabel, typeMap) with a non-null java.util.Map type map on a federation ResultSet — e.g. Oracle object types mapped through a connection's type map.

Common situations: Legacy Oracle object-relational code carried into a ShardingSphere deployment; utilities that always pass a type map (even an empty one) when reading STRUCT-typed columns; migration from a driver connection to federation mode.

Related errors


AI-assisted analysis of apache/shardingsphere@e952770a21 (2026-08-14). Data as JSON: /api/errors/ee1c672e074e9614. Report an issue: GitHub.