apache/shardingsphere · error · SQLFeatureNotSupportedException
rowInserted
Error message
rowInserted
What it means
rowInserted() is a final method in AbstractUnsupportedOperationResultSet that always throws SQLFeatureNotSupportedException. Visible-insert detection is part of the updatable-cursor model the sharding driver does not implement, since its merged rows come from many physical ResultSets.
Source
Thrown at jdbc/src/main/java/org/apache/shardingsphere/driver/jdbc/unsupported/AbstractUnsupportedOperationResultSet.java:130
@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
public final boolean rowInserted() throws SQLException {
throw new SQLFeatureNotSupportedException("rowInserted");
}
@Override
public final boolean rowUpdated() throws SQLException {
throw new SQLFeatureNotSupportedException("rowUpdated");
}
@Override
public final boolean rowDeleted() throws SQLException {
throw new SQLFeatureNotSupportedException("rowDeleted");
}
@Override
public final String getCursorName() throws SQLException {
throw new SQLFeatureNotSupportedException("getCursorName");
}
@OverrideView on GitHub (pinned to e952770a21)
Solutions
- Track insertions in application state (e.g. a key set collected when you execute INSERTs) instead of asking the ResultSet.
- Rewrite the check as a SQL EXISTS/primary-key query against the table.
- Run the visibility checks on the physical datasource connection if truly needed.
Example fix
// before
if (rs.rowInserted()) { /* ... */ } // throws
// after
Set<Long> insertedIds = new HashSet<>(); // maintained when you run INSERTs
if (insertedIds.contains(id)) { /* ... */ } Defensive patterns
Strategy: try-catch
Validate before calling
// capability is absent under this driver; detect driver up front
boolean isSharding = conn.getMetaData().getURL().startsWith("jdbc:shardingsphere:"); Try / catch
try {
boolean inserted = rs.rowInserted();
} catch (SQLFeatureNotSupportedException e) {
inserted = insertedIds.contains(id); // app-tracked set
} Prevention
- Track inserts in application state (key sets) rather than asking the cursor.
- Never depend on visible-insert semantics from a merged/sharded ResultSet.
When it happens
Trigger: Calling ResultSet.rowInserted() on a ResultSet from ShardingSphereDataSource — commonly inside change-tracking loops of editable grids or sync code that flags rows inserted through the cursor since the last fetch.
Common situations: Data-sync or diff tools written against updatable ResultSets; JDBC tutorial sample code reused verbatim; frameworks that detect row visibility changes after batch inserts.
Related errors
AI-assisted analysis of apache/shardingsphere@e952770a21 (2026-08-14).
Data as JSON: /api/errors/b7f242b9aac9d58c.
Report an issue: GitHub.