apache/shardingsphere · error · SQLFeatureNotSupportedException

refreshRow

Error message

refreshRow

What it means

refreshRow() is marked final in AbstractUnsupportedOperationResultSet and always throws SQLFeatureNotSupportedException. Re-fetching the current row from the database is meaningless in the sharding driver because the merged view has no single backing cursor row to refresh.

Source

Thrown at jdbc/src/main/java/org/apache/shardingsphere/driver/jdbc/unsupported/AbstractUnsupportedOperationResultSet.java:110

    
    @Override
    public final void insertRow() throws SQLException {
        throw new SQLFeatureNotSupportedException("insertRow");
    }
    
    @Override
    public final void updateRow() throws SQLException {
        throw new SQLFeatureNotSupportedException("updateRow");
    }
    
    @Override
    public final void deleteRow() throws SQLException {
        throw new SQLFeatureNotSupportedException("deleteRow");
    }
    
    @Override
    public final void refreshRow() throws SQLException {
        throw new SQLFeatureNotSupportedException("refreshRow");
    }
    
    @Override
    public final void cancelRowUpdates() throws SQLException {
        throw new SQLFeatureNotSupportedException("cancelRowUpdates");
    }
    
    @Override
    public final void moveToInsertRow() throws SQLException {
        throw new SQLFeatureNotSupportedException("moveToInsertRow");
    }
    
    @Override
    public final void moveToCurrentRow() throws SQLException {
        throw new SQLFeatureNotSupportedException("moveToCurrentRow");
    }
    
    @Override

View on GitHub (pinned to e952770a21)

Solutions

  1. Re-execute the original query (possibly on the same key range) to obtain fresh data instead of refreshing in place.
  2. Disable the framework feature that triggers refreshRow (e.g. disable updatable/refreshable result sets in the ORM or grid component).
  3. Query the specific row with a keyed SELECT if only one row needs refreshing.

Example fix

// before
rs.refreshRow(); // throws

// after
try (PreparedStatement ps = conn.prepareStatement("SELECT * FROM t WHERE id = ?")) {
    ps.setLong(1, id);
    try (ResultSet fresh = ps.executeQuery()) { /* re-read */ }
}
Defensive patterns

Strategy: try-catch

Validate before calling

// no pre-call capability flag exists; detect the driver up front
boolean isSharding = conn.getMetaData().getURL().startsWith("jdbc:shardingsphere:");
if (isSharding) { /* re-query instead of refreshRow */ }

Try / catch

try {
    rs.refreshRow();
} catch (SQLFeatureNotSupportedException e) {
    rs = reExecuteQuery(conn, sql, params); // rebuild the ResultSet
}

Prevention

When it happens

Trigger: Calling ResultSet.refreshRow() on a ResultSet from ShardingSphereDataSource, often after external modifications, or from ORM cache-refresh logic (e.g. Hibernate force-refresh) and Swing/SWT table bindings that call refreshRow after edits.

Common situations: Desktop CRUD tools or ORM refresh features assuming a live updatable cursor; code migrated from drivers (MySQL Connector/J with CONCUR_UPDATABLE, Oracle) that implement refreshRow.

Related errors


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