{"record":{"id":"578257205b4f6efe","repo":"apache/shardingsphere","slug":"cancelrowupdates-578257","errorCode":null,"errorMessage":"cancelRowUpdates","messagePattern":"cancelRowUpdates","errorType":"exception","errorClass":"SQLFeatureNotSupportedException","httpStatus":null,"severity":"error","filePath":"kernel/sql-federation/core/src/main/java/org/apache/shardingsphere/sqlfederation/resultset/AbstractUnsupportedOperationSQLFederationResultSet.java","lineNumber":115,"sourceCode":"    \n    @Override\n    public final void updateRow() throws SQLException {\n        throw new SQLFeatureNotSupportedException(\"updateRow\");\n    }\n    \n    @Override\n    public final void deleteRow() throws SQLException {\n        throw new SQLFeatureNotSupportedException(\"deleteRow\");\n    }\n    \n    @Override\n    public final void refreshRow() throws SQLException {\n        throw new SQLFeatureNotSupportedException(\"refreshRow\");\n    }\n    \n    @Override\n    public final void cancelRowUpdates() throws SQLException {\n        throw new SQLFeatureNotSupportedException(\"cancelRowUpdates\");\n    }\n    \n    @Override\n    public final void moveToInsertRow() throws SQLException {\n        throw new SQLFeatureNotSupportedException(\"moveToInsertRow\");\n    }\n    \n    @Override\n    public final void moveToCurrentRow() throws SQLException {\n        throw new SQLFeatureNotSupportedException(\"moveToCurrentRow\");\n    }\n    \n    @Override\n    public final boolean rowInserted() throws SQLException {\n        throw new SQLFeatureNotSupportedException(\"rowInserted\");\n    }\n    \n    @Override","sourceCodeStart":97,"sourceCodeEnd":133,"githubUrl":"https://github.com/apache/shardingsphere/blob/e952770a215630a3659c75d64369168cd3e26b82/kernel/sql-federation/core/src/main/java/org/apache/shardingsphere/sqlfederation/resultset/AbstractUnsupportedOperationSQLFederationResultSet.java#L97-L133","documentation":"cancelRowUpdates() — undoing pending updateXXX() edits on the current row — throws SQLFeatureNotSupportedException because the federation ResultSet is read-only and never accepts row updates in the first place. The method is final in AbstractUnsupportedOperationSQLFederationResultSet, so the rejection is unconditional.","triggerScenarios":"Calling rs.cancelRowUpdates() in an updatable-result-set edit flow (updateXXX ... then cancel) executed against a federation-routed statement.","commonSituations":"Cancel-edit actions in grid editors; rollback-on-validation-failure logic written for updatable cursors on a standalone database; the call usually follows earlier failed updateRow() usage, indicating the whole cursor-editing pattern must be replaced for federation datasources.","solutions":["Drop the cursor-edit pattern entirely: track pending edits in application objects and issue explicit UPDATE statements on save","In UI editors, disable inline editing for federation connections so cancelRowUpdates is never reached","Route the affected statement outside federation if cursor editing is a hard requirement"],"exampleFix":"// before\nrs.updateString(\"name\", draft);\nif (!valid) { rs.cancelRowUpdates(); }\n\n// after\nif (valid) {\n    try (PreparedStatement ps = conn.prepareStatement(\"UPDATE t SET name = ? WHERE id = ?\")) {\n        ps.setString(1, draft); ps.setLong(2, id); ps.executeUpdate();\n    }\n}","handlingStrategy":"try-catch","validationCode":"if (rs.getConcurrency() == ResultSet.CONCUR_READ_ONLY) {\n    // cancelRowUpdates() unreachable by design: edits were never accepted\n}","typeGuard":"private boolean isUpdatable(final ResultSet rs) throws SQLException {\n    return rs.getConcurrency() == ResultSet.CONCUR_UPDATABLE;\n}","tryCatchPattern":"try {\n    rs.cancelRowUpdates();\n} catch (final SQLFeatureNotSupportedException e) {\n    // read-only result set: nothing to cancel, discard local pending edits\n    pendingEdits.clear();\n}","preventionTips":["Model pending edits in application state, not cursor state","Skip cancelRowUpdates when getConcurrency() is READ_ONLY","Avoid cursor-edit flows entirely on federation connections"],"tags":["jdbc","resultset","sql-federation","updatable-cursor","shardingsphere"],"backgroundTag":null,"analyzedSha":"e952770a215630a3659c75d64369168cd3e26b82","analyzedAt":"2026-08-14T13:54:53.392Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}