{"record":{"id":"a03abaccac38194d","repo":"apache/shardingsphere","slug":"getobject-with-type-a03aba","errorCode":null,"errorMessage":"getObject with type","messagePattern":"getObject with type","errorType":"exception","errorClass":"SQLFeatureNotSupportedException","httpStatus":null,"severity":"error","filePath":"kernel/sql-federation/core/src/main/java/org/apache/shardingsphere/sqlfederation/resultset/AbstractUnsupportedOperationSQLFederationResultSet.java","lineNumber":195,"sourceCode":"    \n    @Override\n    public final Ref getRef(final String columnLabel) throws SQLException {\n        throw new SQLFeatureNotSupportedException(\"getRef\");\n    }\n    \n    @Override\n    public final RowId getRowId(final int columnIndex) throws SQLException {\n        throw new SQLFeatureNotSupportedException(\"getRowId\");\n    }\n    \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":177,"sourceCodeEnd":213,"githubUrl":"https://github.com/apache/shardingsphere/blob/e952770a215630a3659c75d64369168cd3e26b82/kernel/sql-federation/core/src/main/java/org/apache/shardingsphere/sqlfederation/resultset/AbstractUnsupportedOperationSQLFederationResultSet.java#L177-L213","documentation":"JDBC 4.1 added getObject(int, Class<T>) for typed column conversion, but ShardingSphere's federation ResultSet only implements the untyped getObject. The typed variant is final and throws SQLFeatureNotSupportedException('getObject with type') for every target type.","triggerScenarios":"Calling ResultSet.getObject(1, LocalDate.class), getObject(1, Optional.class), or any typed getObject(int, Class) on a federation ResultSet. Java-8-date-and-time ORMs and JPA converters frequently emit this call.","commonSituations":"JDBC 4.2 code paths (java.time conversions) reused under ShardingSphere federation; Hibernate 5+/JPA providers converting columns to LocalDate/Instant; upgrading a datasource to federation without testing date-heavy read paths.","solutions":["Read with the classic typed accessor (getDate/getTimestamp/getString) and convert with valueOf/map helpers, e.g. rs.getTimestamp(1).toLocalDateTime().","Register an ORM converter/type handler so the framework uses classic accessors for federation queries.","Exclude the statement from federation so the native driver (JDBC 4.2-capable) ResultSet is used.","Centralize the fallback in one row-mapper utility so callers never emit typed getObject."],"exampleFix":"// before\nLocalDate date = resultSet.getObject(1, LocalDate.class);\n\n// after\nLocalDate date = resultSet.getDate(1).toLocalDate();","handlingStrategy":"fallback","validationCode":"// prefer classic typed accessors when running under ShardingSphere federation\nboolean federation = resultSet.getClass().getName().contains(\"sqlfederation\");","typeGuard":null,"tryCatchPattern":"try { date = rs.getObject(1, LocalDate.class); } catch (SQLFeatureNotSupportedException e) { date = rs.getDate(1).toLocalDate(); }","preventionTips":["Map java.time fields with classic accessors (getDate/getTimestamp + conversions) in code shared with federation.","Verify ORM type handlers against federation ResultSets in integration tests.","Keep a shared conversion utility so typed getObject is never called directly."],"tags":["jdbc","sql-federation","resultset","unsupported-operation","jdbc41","java-time"],"backgroundTag":null,"analyzedSha":"e952770a215630a3659c75d64369168cd3e26b82","analyzedAt":"2026-08-14T13:54:53.392Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}