{"record":{"id":"2e523e060c771693","repo":"apache/shardingsphere","slug":"getobject-with-map","errorCode":null,"errorMessage":"getObject with map","messagePattern":"getObject with map","errorType":"exception","errorClass":"SQLFeatureNotSupportedException","httpStatus":null,"severity":"error","filePath":"jdbc/src/main/java/org/apache/shardingsphere/driver/jdbc/unsupported/AbstractUnsupportedOperationResultSet.java","lineNumber":205,"sourceCode":"    \n    @Override\n    public final RowId getRowId(final String columnLabel) throws SQLException {\n        throw new SQLFeatureNotSupportedException(\"getRowId\");\n    }\n    \n    @Override\n    public <T> T getObject(final int columnIndex, final Class<T> type) throws SQLException {\n        throw new SQLFeatureNotSupportedException(\"getObject with type\");\n    }\n    \n    @Override\n    public <T> T getObject(final String columnLabel, final Class<T> type) throws SQLException {\n        throw new SQLFeatureNotSupportedException(\"getObject with type\");\n    }\n    \n    @Override\n    public final Object getObject(final String columnLabel, final Map<String, Class<?>> map) throws SQLException {\n        throw new SQLFeatureNotSupportedException(\"getObject with map\");\n    }\n    \n    @Override\n    public final Object getObject(final int columnIndex, final Map<String, Class<?>> map) throws SQLException {\n        throw new SQLFeatureNotSupportedException(\"getObject with map\");\n    }\n}\n","sourceCodeStart":187,"sourceCodeEnd":213,"githubUrl":"https://github.com/apache/shardingsphere/blob/e952770a215630a3659c75d64369168cd3e26b82/jdbc/src/main/java/org/apache/shardingsphere/driver/jdbc/unsupported/AbstractUnsupportedOperationResultSet.java#L187-L213","documentation":"ShardingSphere's driver ResultSet does not implement getObject(String columnLabel, Map<String, Class<?>> map). It throws SQLFeatureNotSupportedException('getObject with map'). The map-based overload is used for structured/DISTINCT object types (SQL:1999 structured types) and is rarely implemented by sharding or pooling drivers; only the single-argument getObject is supported.","triggerScenarios":"Calling rs.getObject(\"column\", typeMap) or rs.getObject(index, typeMap) with a non-empty java.util.Map of SQL type names to Java classes — typically code ported from Oracle that reads STRUCT/REF/DISTINCT typed columns through a connection type map.","commonSituations":"Porting Oracle JDBC code that uses connection type maps for object types to a sharded MySQL/PostgreSQL setup via jdbc:shardingsphere:; legacy DAO layers that always pass a type map even for scalar columns; tools/beans that introspect ResultSet methods and invoke the Map overload generically.","solutions":["Drop the Map argument and call rs.getObject(\"column\") / rs.getObject(i), then cast the returned Object yourself.","If the column really is a structured/Oracle object type, read it through the native driver connection, not the ShardingSphere connection.","Wrap access in a helper that detects SQLFeatureNotSupportedException and falls back to the 1-arg overload for scalar columns."],"exampleFix":"// before\nObject v = rs.getObject(\"order_type\", typeMap);\n\n// after\nObject v = rs.getObject(\"order_type\");","handlingStrategy":"try-catch","validationCode":"if (typeMap != null && !typeMap.isEmpty() && conn.getMetaData().getURL().startsWith(\"jdbc:shardingsphere:\")) {\n    // map-based getObject is unsupported; use the 1-arg overload\n}","typeGuard":"private static Object getObjectSafe(ResultSet rs, String label, Map<String, Class<?>> map) throws SQLException {\n    try {\n        return rs.getObject(label, map);\n    } catch (SQLFeatureNotSupportedException e) {\n        return rs.getObject(label);\n    }\n}","tryCatchPattern":"try {\n    v = rs.getObject(label, typeMap);\n} catch (SQLFeatureNotSupportedException e) {\n    v = rs.getObject(label);\n}","preventionTips":["Never pass a type map unless the column is a real structured type on a driver that supports it.","Strip Oracle-specific type-map plumbing when porting to MySQL/PostgreSQL sharding.","Guard vendor-specific JDBC extensions behind a dialect layer."],"tags":["jdbc","resultset","shardingsphere","type-map","unsupported-operation"],"backgroundTag":null,"analyzedSha":"e952770a215630a3659c75d64369168cd3e26b82","analyzedAt":"2026-08-14T13:54:53.392Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}