{"record":{"id":"a0a3739cb04967dc","repo":"apache/shardingsphere","slug":"updatetime","errorCode":null,"errorMessage":"updateTime","messagePattern":"updateTime","errorType":"exception","errorClass":"SQLFeatureNotSupportedException","httpStatus":null,"severity":"error","filePath":"kernel/sql-federation/core/src/main/java/org/apache/shardingsphere/sqlfederation/resultset/AbstractUnsupportedUpdateOperationSQLFederationResultSet.java","lineNumber":174,"sourceCode":"    \n    @Override\n    public final void updateBytes(final String columnLabel, final byte[] x) throws SQLException {\n        throw new SQLFeatureNotSupportedException(\"updateBytes\");\n    }\n    \n    @Override\n    public final void updateDate(final int columnIndex, final Date x) throws SQLException {\n        throw new SQLFeatureNotSupportedException(\"updateDate\");\n    }\n    \n    @Override\n    public final void updateDate(final String columnLabel, final Date x) throws SQLException {\n        throw new SQLFeatureNotSupportedException(\"updateDate\");\n    }\n    \n    @Override\n    public final void updateTime(final int columnIndex, final Time x) throws SQLException {\n        throw new SQLFeatureNotSupportedException(\"updateTime\");\n    }\n    \n    @Override\n    public final void updateTime(final String columnLabel, final Time x) throws SQLException {\n        throw new SQLFeatureNotSupportedException(\"updateTime\");\n    }\n    \n    @Override\n    public final void updateTimestamp(final int columnIndex, final Timestamp x) throws SQLException {\n        throw new SQLFeatureNotSupportedException(\"updateTimestamp\");\n    }\n    \n    @Override\n    public final void updateTimestamp(final String columnLabel, final Timestamp x) throws SQLException {\n        throw new SQLFeatureNotSupportedException(\"updateTimestamp\");\n    }\n    \n    @Override","sourceCodeStart":156,"sourceCodeEnd":192,"githubUrl":"https://github.com/apache/shardingsphere/blob/e952770a215630a3659c75d64369168cd3e26b82/kernel/sql-federation/core/src/main/java/org/apache/shardingsphere/sqlfederation/resultset/AbstractUnsupportedUpdateOperationSQLFederationResultSet.java#L156-L192","documentation":"ShardingSphere's federation ResultSets make the JDBC updatable-cursor contract explicitly unavailable: AbstractUnsupportedUpdateOperationSQLFederationResultSet overrides every updateXxx method to throw SQLFeatureNotSupportedException, with 'updateTime' as the message for the column-index overload of the time updater. Federated rows are in-memory computed results, so writing a java.sql.Time in place through the cursor always fails.","triggerScenarios":"Calling ResultSet.updateTime(int columnIndex, Time x) on the ResultSet of a federated statement (sql_federation enabled, e.g. cross-shard join). Encountered in timesheet/scheduling code or generic temporal column writers that use cursor updates.","commonSituations":"Code ported from driver-native updatable ResultSets to a ShardingSphere federated datasource; sqlFederation enabled globally so existing statements federate; shared JDBC utility layers that patch TIME columns via updateTime regardless of the ResultSet implementation.","solutions":["Read with getTime(columnIndex) and write through a PreparedStatement UPDATE using setTime, keyed on the primary key.","Check rs.getConcurrency() before entering update-cursor code and use statement-based updates for read-only sets.","Configure the sql_federation rule so the statement bypasses federation and gets the driver's native ResultSet."],"exampleFix":"// before\nrs.updateTime(4, Time.valueOf(\"12:30:00\"));  // SQLFeatureNotSupportedException: updateTime\nrs.updateRow();\n\n// after\ntry (PreparedStatement upd = conn.prepareStatement(\"UPDATE shifts SET start_time = ? WHERE id = ?\")) {\n    upd.setTime(1, Time.valueOf(\"12:30:00\"));\n    upd.setLong(2, rs.getLong(1));\n    upd.executeUpdate();\n}","handlingStrategy":"try-catch","validationCode":"if (rs.getConcurrency() != ResultSet.CONCUR_UPDATABLE) {\n    // rs.updateTime(...) unsupported; use UPDATE + setTime\n}","typeGuard":"private static boolean supportsRowUpdates(final ResultSet rs) throws SQLException {\n    return rs.getConcurrency() == ResultSet.CONCUR_UPDATABLE;\n}","tryCatchPattern":"try {\n    rs.updateTime(4, time);\n} catch (final SQLFeatureNotSupportedException ignored) {\n    try (PreparedStatement upd = conn.prepareStatement(\"UPDATE shifts SET start_time = ? WHERE id = ?\")) {\n        upd.setTime(1, time);\n        upd.setLong(2, rs.getLong(1));\n        upd.executeUpdate();\n    }\n}","preventionTips":["Write time columns via setTime on keyed UPDATE statements.","Check concurrency before timesheet cursor edits.","Keep editable time fields away from federated result sets."],"tags":["jdbc","resultset","sql-federation","read-only","shardingsphere","time"],"backgroundTag":null,"analyzedSha":"e952770a215630a3659c75d64369168cd3e26b82","analyzedAt":"2026-08-14T13:54:53.392Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}