{"record":{"id":"afd37192064a60da","repo":"apache/shardingsphere","slug":"getfetchsize","errorCode":null,"errorMessage":"getFetchSize","messagePattern":"getFetchSize","errorType":"exception","errorClass":"SQLFeatureNotSupportedException","httpStatus":null,"severity":"error","filePath":"jdbc/src/main/java/org/apache/shardingsphere/driver/jdbc/unsupported/AbstractUnsupportedGeneratedKeysResultSet.java","lineNumber":187,"sourceCode":"    \n    @Override\n    public final void setFetchDirection(final int direction) throws SQLException {\n        throw new SQLFeatureNotSupportedException(\"setFetchDirection\");\n    }\n    \n    @Override\n    public final int getFetchDirection() throws SQLException {\n        throw new SQLFeatureNotSupportedException(\"getFetchDirection\");\n    }\n    \n    @Override\n    public final void setFetchSize(final int rows) throws SQLException {\n        throw new SQLFeatureNotSupportedException(\"setFetchSize\");\n    }\n    \n    @Override\n    public final int getFetchSize() throws SQLException {\n        throw new SQLFeatureNotSupportedException(\"getFetchSize\");\n    }\n    \n    @Override\n    public final Blob getBlob(final int columnIndex) throws SQLException {\n        throw new SQLFeatureNotSupportedException(\"getBlob\");\n    }\n    \n    @Override\n    public final Blob getBlob(final String columnLabel) throws SQLException {\n        throw new SQLFeatureNotSupportedException(\"getBlob\");\n    }\n    \n    @Override\n    public final Clob getClob(final int columnIndex) throws SQLException {\n        throw new SQLFeatureNotSupportedException(\"getClob\");\n    }\n    \n    @Override","sourceCodeStart":169,"sourceCodeEnd":205,"githubUrl":"https://github.com/apache/shardingsphere/blob/e952770a215630a3659c75d64369168cd3e26b82/jdbc/src/main/java/org/apache/shardingsphere/driver/jdbc/unsupported/AbstractUnsupportedGeneratedKeysResultSet.java#L169-L205","documentation":"getFetchSize() is rejected with SQLFeatureNotSupportedException(\"getFetchSize\") by AbstractUnsupportedGeneratedKeysResultSet:187, the base class of ShardingSphere's GeneratedKeysResultSet. The key values live in an in-memory iterator, so there is no fetch size to report and the getter is part of the unsupported fetch-hint surface (setFetchDirection/getFetchDirection/setFetchSize/getFetchSize are all closed together).","triggerScenarios":"Calling resultSet.getFetchSize() on the keys ResultSet — e.g. diagnostics that log result-set configuration, or generic iteration wrappers that choose processing strategy based on reported fetch size.","commonSituations":"Monitoring/audit tooling that records fetch size of every result set; pagination frameworks probing fetch size; behavior change after migrating INSERT-heavy services to ShardingSphere-JDBC where native drivers returned the driver default.","solutions":["Do not read fetch size from generated-keys result sets; the concept does not apply.","In generic diagnostics, catch SQLFeatureNotSupportedException and log 'n/a' or fall back to the Statement's value.","Feature-probe per result-set class in wrapper libraries to avoid repeated exceptions.","Keep fetch-size accounting on the Statement or query result sets."],"exampleFix":"// before\nint size = rs.getFetchSize();\n\n// after\nint size;\ntry {\n    size = rs.getFetchSize();\n} catch (SQLFeatureNotSupportedException e) {\n    size = -1; // not applicable to generated-keys result set\n}","handlingStrategy":"try-catch","validationCode":"// read fetch size from the Statement instead of the generated-keys ResultSet\nint size = stmt.getFetchSize();","typeGuard":"private static boolean supportsFetchHints(ResultSet rs) {\n    return !rs.getClass().getName().endsWith(\"GeneratedKeysResultSet\");\n}","tryCatchPattern":"int size;\ntry {\n    size = rs.getFetchSize();\n} catch (SQLFeatureNotSupportedException e) {\n    size = -1; // n/a\n}","preventionTips":["Point diagnostics at Statement-level fetch size.","Treat 'unsupported' as a normal probe outcome, not an error.","Record capability results once per result-set class."],"tags":["jdbc","shardingsphere","generated-keys","fetch-size","unsupported-operation"],"backgroundTag":null,"analyzedSha":"e952770a215630a3659c75d64369168cd3e26b82","analyzedAt":"2026-08-14T13:54:53.392Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}