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");
}
@OverrideView on GitHub (pinned to e952770a21)
Solutions
- Replace with an explicit UPDATE table SET col = ? WHERE pk = ? executed through ShardingSphere.
- Verify rs.getConcurrency() == ResultSet.CONCUR_UPDATABLE before any updateXXX call and otherwise branch to SQL updates.
- Ensure interactive editing uses a non-federated datasource or federation is disabled for those statements.
- 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
- Replace client-side row edits with keyed UPDATE statements under federation.
- Check getConcurrency() before any updateXXX call.
- Keep interactive editors on non-federated datasources.
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.