{"record":{"id":"214816aeacfc95d3","repo":"apache/shardingsphere","slug":"refreshrow-214816","errorCode":null,"errorMessage":"refreshRow","messagePattern":"refreshRow","errorType":"exception","errorClass":"SQLFeatureNotSupportedException","httpStatus":null,"severity":"error","filePath":"kernel/sql-federation/core/src/main/java/org/apache/shardingsphere/sqlfederation/resultset/AbstractUnsupportedOperationSQLFederationResultSet.java","lineNumber":110,"sourceCode":"    \n    @Override\n    public final void insertRow() throws SQLException {\n        throw new SQLFeatureNotSupportedException(\"insertRow\");\n    }\n    \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","sourceCodeStart":92,"sourceCodeEnd":128,"githubUrl":"https://github.com/apache/shardingsphere/blob/e952770a215630a3659c75d64369168cd3e26b82/kernel/sql-federation/core/src/main/java/org/apache/shardingsphere/sqlfederation/resultset/AbstractUnsupportedOperationSQLFederationResultSet.java#L92-L128","documentation":"refreshRow() — re-reading the current row from the database — throws SQLFeatureNotSupportedException in the federation ResultSet. Refreshing requires re-executing positioned reads against the underlying storage, which the one-shot federation result stream does not model, so the abstract class rejects it unconditionally.","triggerScenarios":"Calling rs.refreshRow() on a federated ResultSet, typically to pick up concurrent external changes to the row being displayed (optimistic-refresh pattern in editors or long-lived result screens).","commonSituations":"Optimistic-concurrency UIs that refresh rows before commit; tools that call refreshRow() after a save; migrating long-lived ResultSet usage from a native driver (where refreshRow may be supported) to ShardingSphere federation, where the ResultSet is a static snapshot of the federated result.","solutions":["Re-execute the query (or a keyed SELECT of the row) to observe current data instead of refreshRow()","Shorten ResultSet lifetime: read rows into DTOs promptly so stale-snapshot refresh becomes a non-issue","Ensure the statement bypasses federation if positioned refresh semantics are required by the application contract"],"exampleFix":"// before\nrs.refreshRow();\n\n// after\ntry (PreparedStatement ps = conn.prepareStatement(\"SELECT * FROM t WHERE id = ?\")) {\n    ps.setLong(1, id);\n    try (ResultSet fresh = ps.executeQuery()) { ... }\n}","handlingStrategy":"try-catch","validationCode":"if (rs.getConcurrency() == ResultSet.CONCUR_READ_ONLY) {\n    // refreshRow() unsupported: re-query the row by primary key instead\n}","typeGuard":"private boolean canRefresh(final ResultSet rs) throws SQLException {\n    return rs.getConcurrency() == ResultSet.CONCUR_UPDATABLE;\n}","tryCatchPattern":"try {\n    rs.refreshRow();\n} catch (final SQLFeatureNotSupportedException e) {\n    reloadRowByKey(conn, tableName, id); // re-query fallback\n}","preventionTips":["Prefer short-lived ResultSets; read into DTOs early","Use keyed re-select instead of refreshRow","Add version/updated_at columns for change detection"],"tags":["jdbc","resultset","sql-federation","refresh","shardingsphere"],"backgroundTag":null,"analyzedSha":"e952770a215630a3659c75d64369168cd3e26b82","analyzedAt":"2026-08-14T13:54:53.392Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}