{"record":{"id":"01438eb252642045","repo":"apache/shardingsphere","slug":"updatenull","errorCode":null,"errorMessage":"updateNull","messagePattern":"updateNull","errorType":"exception","errorClass":"SQLFeatureNotSupportedException","httpStatus":null,"severity":"error","filePath":"kernel/sql-federation/core/src/main/java/org/apache/shardingsphere/sqlfederation/resultset/AbstractUnsupportedUpdateOperationSQLFederationResultSet.java","lineNumber":44,"sourceCode":"import java.sql.Date;\nimport java.sql.NClob;\nimport java.sql.Ref;\nimport java.sql.ResultSet;\nimport java.sql.RowId;\nimport java.sql.SQLException;\nimport java.sql.SQLFeatureNotSupportedException;\nimport java.sql.SQLXML;\nimport java.sql.Time;\nimport java.sql.Timestamp;\n\n/**\n * Unsupported {@code ResultSet} update methods for SQL federation.\n */\npublic abstract class AbstractUnsupportedUpdateOperationSQLFederationResultSet extends SQLFederationWrapperAdapter implements ResultSet {\n    \n    @Override\n    public final void updateNull(final int columnIndex) throws SQLException {\n        throw new SQLFeatureNotSupportedException(\"updateNull\");\n    }\n    \n    @Override\n    public final void updateNull(final String columnLabel) throws SQLException {\n        throw new SQLFeatureNotSupportedException(\"updateNull\");\n    }\n    \n    @Override\n    public final void updateBoolean(final int columnIndex, final boolean x) throws SQLException {\n        throw new SQLFeatureNotSupportedException(\"updateBoolean\");\n    }\n    \n    @Override\n    public final void updateBoolean(final String columnLabel, final boolean x) throws SQLException {\n        throw new SQLFeatureNotSupportedException(\"updateBoolean\");\n    }\n    \n    @Override","sourceCodeStart":26,"sourceCodeEnd":62,"githubUrl":"https://github.com/apache/shardingsphere/blob/e952770a215630a3659c75d64369168cd3e26b82/kernel/sql-federation/core/src/main/java/org/apache/shardingsphere/sqlfederation/resultset/AbstractUnsupportedUpdateOperationSQLFederationResultSet.java#L26-L62","documentation":"ShardingSphere federation ResultSets are read-only: they materialize federated query output in memory, so JDBC row-updater updateNull(int) is explicitly forbidden. The method is final in AbstractUnsupportedUpdateOperationSQLFederationResultSet and throws SQLFeatureNotSupportedException on every call.","triggerScenarios":"Calling ResultSet.updateNull(int columnIndex) on a federation ResultSet — i.e. any attempt to modify a row in place (updatable ResultSet pattern) instead of issuing an UPDATE statement. Requires a ResultSet with CONCUR_UPDATABLE semantics in normal JDBC.","commonSituations":"Code assuming updatable ResultSets (JDBC rowset editing, GUI table editors, some legacy DAO frameworks); enabling sql-federation on a datasource used by tools that call updateXXX/updateRow; migration from a driver where CONCUR_UPDATABLE worked.","solutions":["Replace in-place updates with an explicit UPDATE ... SET col = NULL statement executed through ShardingSphere normally.","Check rs.getConcurrency() == ResultSet.CONCUR_UPDATABLE before calling update methods and fall back to SQL updates.","Do not enable federation for statements used by updatable-ResultSet tooling; route them to a plain datasource.","File a feature request if updatable federated results are a product requirement."],"exampleFix":"// before\nresultSet.updateNull(3);\nresultSet.updateRow();\n\n// after\n// close the ResultSet and run:\n// UPDATE t SET col3 = NULL WHERE id = ?","handlingStrategy":"validation","validationCode":"if (resultSet.getConcurrency() != ResultSet.CONCUR_UPDATABLE) { throw new IllegalStateException(\"read-only result set; use UPDATE SQL\"); }","typeGuard":"boolean isUpdatable(ResultSet rs) throws SQLException { return rs.getConcurrency() == ResultSet.CONCUR_UPDATABLE; }","tryCatchPattern":"try { rs.updateNull(1); rs.updateRow(); } catch (SQLFeatureNotSupportedException e) { /* fall back to UPDATE SQL */ }","preventionTips":["Never use client-side row updates against ShardingSphere federation; always issue UPDATE statements.","Check getConcurrency() before showing edit affordances in UIs.","Bind editable grids to non-federated datasources."],"tags":["jdbc","sql-federation","resultset","unsupported-operation","readonly","updatable-resultset"],"backgroundTag":null,"analyzedSha":"e952770a215630a3659c75d64369168cd3e26b82","analyzedAt":"2026-08-14T13:54:53.392Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}