apache/shardingsphere · error · SQLFeatureNotSupportedException

updateInt

Error message

updateInt

What it means

updateInt(int, int) is one of the most commonly invoked members of the updatable-ResultSet API, and it is explicitly unsupported by ShardingSphere's federation engine. The final override in AbstractUnsupportedUpdateOperationSQLFederationResultSet throws SQLFeatureNotSupportedException on every call because federated rows are read-only.

Source

Thrown at kernel/sql-federation/core/src/main/java/org/apache/shardingsphere/sqlfederation/resultset/AbstractUnsupportedUpdateOperationSQLFederationResultSet.java:84

    
    @Override
    public final void updateByte(final String columnLabel, final byte x) throws SQLException {
        throw new SQLFeatureNotSupportedException("updateByte");
    }
    
    @Override
    public final void updateShort(final int columnIndex, final short x) throws SQLException {
        throw new SQLFeatureNotSupportedException("updateShort");
    }
    
    @Override
    public final void updateShort(final String columnLabel, final short x) throws SQLException {
        throw new SQLFeatureNotSupportedException("updateShort");
    }
    
    @Override
    public final void updateInt(final int columnIndex, final int x) throws SQLException {
        throw new SQLFeatureNotSupportedException("updateInt");
    }
    
    @Override
    public final void updateInt(final String columnLabel, final int x) throws SQLException {
        throw new SQLFeatureNotSupportedException("updateInt");
    }
    
    @Override
    public final void updateLong(final int columnIndex, final long x) throws SQLException {
        throw new SQLFeatureNotSupportedException("updateLong");
    }
    
    @Override
    public final void updateLong(final String columnLabel, final long x) throws SQLException {
        throw new SQLFeatureNotSupportedException("updateLong");
    }
    
    @Override

View on GitHub (pinned to e952770a21)

Solutions

  1. Replace with an explicit UPDATE table SET col = ? WHERE pk = ? executed through ShardingSphere.
  2. Verify rs.getConcurrency() == ResultSet.CONCUR_UPDATABLE before any updateXXX call and otherwise branch to SQL updates.
  3. Ensure interactive editing uses a non-federated datasource or federation is disabled for those statements.
  4. Cover mutation paths with federation-enabled integration tests in CI.

Example fix

// before
resultSet.updateInt(3, 100);
resultSet.updateRow();

// after
// UPDATE account SET balance = 100 WHERE id = ?
Defensive patterns

Strategy: validation

Validate before calling

if (resultSet.getConcurrency() != ResultSet.CONCUR_UPDATABLE) { throw new SQLFeatureNotSupportedException("in-place updates not supported; use UPDATE SQL"); }

Type guard

boolean isUpdatable(ResultSet rs) throws SQLException { return rs.getConcurrency() == ResultSet.CONCUR_UPDATABLE; }

Try / catch

try { rs.updateInt(3, 100); rs.updateRow(); } catch (SQLFeatureNotSupportedException e) { /* UPDATE account SET balance = 100 WHERE id = ? */ }

Prevention

When it happens

Trigger: Calling ResultSet.updateInt(columnIndex, value) (then updateRow()) on a ResultSet returned by a federated query — e.g. editing an integer column of a joined, cross-shard result in place.

Common situations: Table-editor components and rowset frameworks doing client-side edits; code that worked against a driver-issued CONCUR_UPDATABLE ResultSet before sql-federation was enabled; JTable/DbGrid style admin UIs.

Related errors


AI-assisted analysis of apache/shardingsphere@e952770a21 (2026-08-14). Data as JSON: /api/errors/7b19e7350469f83e. Report an issue: GitHub.