{"record":{"id":"04d55008282932e6","repo":"apache/shardingsphere","slug":"movetocurrentrow-04d550","errorCode":null,"errorMessage":"moveToCurrentRow","messagePattern":"moveToCurrentRow","errorType":"exception","errorClass":"SQLFeatureNotSupportedException","httpStatus":null,"severity":"error","filePath":"kernel/sql-federation/core/src/main/java/org/apache/shardingsphere/sqlfederation/resultset/AbstractUnsupportedOperationSQLFederationResultSet.java","lineNumber":125,"sourceCode":"    \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\n    public final boolean rowInserted() throws SQLException {\n        throw new SQLFeatureNotSupportedException(\"rowInserted\");\n    }\n    \n    @Override\n    public final boolean rowUpdated() throws SQLException {\n        throw new SQLFeatureNotSupportedException(\"rowUpdated\");\n    }\n    \n    @Override\n    public final boolean rowDeleted() throws SQLException {\n        throw new SQLFeatureNotSupportedException(\"rowDeleted\");\n    }\n    \n    @Override","sourceCodeStart":107,"sourceCodeEnd":143,"githubUrl":"https://github.com/apache/shardingsphere/blob/e952770a215630a3659c75d64369168cd3e26b82/kernel/sql-federation/core/src/main/java/org/apache/shardingsphere/sqlfederation/resultset/AbstractUnsupportedOperationSQLFederationResultSet.java#L107-L143","documentation":"moveToCurrentRow() — returning from the insert row to the previously current row — throws SQLFeatureNotSupportedException in the SQL Federation ResultSet. It only exists in the updatable-cursor model, which federation deliberately does not implement; the method is final and always throws.","triggerScenarios":"Calling rs.moveToCurrentRow() after an insert-row sequence (or to resume iteration after moveToInsertRow) on a federated ResultSet.","commonSituations":"Post-insert cursor restoration in updatable-result-set code; editors that toggle between insert mode and normal browsing; typically the second failure in a chain that began with moveToInsertRow()/insertRow() being called on a federation connection.","solutions":["Remove the insert-row sequence entirely and use explicit INSERT statements, which removes the need for moveToCurrentRow()","Re-execute the query to obtain a fresh ResultSet after inserts instead of repositioning a cursor","Mark federation datasources read-only in editing tools so this code path is never exercised"],"exampleFix":"// before\nrs.insertRow();\nrs.moveToCurrentRow();\n\n// after\n// insert via PreparedStatement, then:\ntry (ResultSet rs2 = stmt.executeQuery(sql)) { /* continue iteration */ }","handlingStrategy":"validation","validationCode":"if (rs.getConcurrency() != ResultSet.CONCUR_UPDATABLE) {\n    // moveToCurrentRow() unsupported: re-execute the query after inserts\n}","typeGuard":"private boolean isUpdatable(final ResultSet rs) throws SQLException {\n    return rs.getConcurrency() == ResultSet.CONCUR_UPDATABLE;\n}","tryCatchPattern":"try {\n    rs.moveToCurrentRow();\n} catch (final SQLFeatureNotSupportedException e) {\n    rs = stmt.executeQuery(sql); // fresh forward-only result set\n}","preventionTips":["Re-query instead of cursor-repositioning after writes","Keep insert and read paths as separate statements","Remove insert-row flows from shared DAO code"],"tags":["jdbc","resultset","sql-federation","updatable-cursor","shardingsphere"],"backgroundTag":null,"analyzedSha":"e952770a215630a3659c75d64369168cd3e26b82","analyzedAt":"2026-08-14T13:54:53.392Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}