{"record":{"id":"b26b5223d5ed6185","repo":"apache/shardingsphere","slug":"getsqlxml-b26b52","errorCode":null,"errorMessage":"getSQLXML","messagePattern":"getSQLXML","errorType":"exception","errorClass":"SQLFeatureNotSupportedException","httpStatus":null,"severity":"error","filePath":"jdbc/src/main/java/org/apache/shardingsphere/driver/jdbc/unsupported/AbstractUnsupportedGeneratedKeysResultSet.java","lineNumber":222,"sourceCode":"    \n    @Override\n    public final Clob getClob(final String columnLabel) throws SQLException {\n        throw new SQLFeatureNotSupportedException(\"getClob\");\n    }\n    \n    @Override\n    public final URL getURL(final int columnIndex) throws SQLException {\n        throw new SQLFeatureNotSupportedException(\"getURL\");\n    }\n    \n    @Override\n    public final URL getURL(final String columnLabel) throws SQLException {\n        throw new SQLFeatureNotSupportedException(\"getURL\");\n    }\n    \n    @Override\n    public final SQLXML getSQLXML(final int columnIndex) throws SQLException {\n        throw new SQLFeatureNotSupportedException(\"getSQLXML\");\n    }\n    \n    @Override\n    public final SQLXML getSQLXML(final String columnLabel) throws SQLException {\n        throw new SQLFeatureNotSupportedException(\"getSQLXML\");\n    }\n}\n","sourceCodeStart":204,"sourceCodeEnd":230,"githubUrl":"https://github.com/apache/shardingsphere/blob/e952770a215630a3659c75d64369168cd3e26b82/jdbc/src/main/java/org/apache/shardingsphere/driver/jdbc/unsupported/AbstractUnsupportedGeneratedKeysResultSet.java#L204-L230","documentation":"getSQLXML(int columnIndex) (and its String overload on line 224) closes out AbstractUnsupportedGeneratedKeysResultSet with an unconditional SQLFeatureNotSupportedException(\"getSQLXML\") throw at line 222. ShardingSphere's generated-keys ResultSet holds synthesized numeric key values, so the JDBC 4 SQLXML accessor — already optional in the JDBC spec — is declared unsupported.","triggerScenarios":"Calling resultSet.getSQLXML(1) or getSQLXML(columnLabel) on the ResultSet obtained from Statement.getGeneratedKeys()/PreparedStatement.getGeneratedKeys() in ShardingSphere-JDBC — e.g. an ORM XML type handler applied generically, or a full-accessor walker.","commonSituations":"Modern ORM type handlers (XML-typed fields) run against every result set; reflection-based mappers enumerating all getters; applications moved onto sharding-jdbc for sharding/encryption where the same INSERT previously ran on a driver accepting the call or throwing a different error.","solutions":["Read the key with getLong(1)/getObject(1); generated keys are never XML.","Scope SQLXML type handling to SELECT result sets only.","In reflective walkers, catch SQLFeatureNotSupportedException and mark the accessor unavailable.","If XML data is needed, fetch it with a later SELECT using the generated key."],"exampleFix":"// before\nSQLXML xml = keys.getSQLXML(1);\n\n// after\nlong id = keys.getLong(1);","handlingStrategy":"try-catch","validationCode":"int type = keys.getMetaData().getColumnType(1);\nif (type == Types.INTEGER || type == Types.BIGINT) { long id = keys.getLong(1); } // never SQLXML","typeGuard":"private static boolean isGeneratedKeysRs(ResultSet rs) {\n    return rs.getClass().getName().endsWith(\"GeneratedKeysResultSet\");\n}","tryCatchPattern":"try {\n    SQLXML xml = rs.getSQLXML(1);\n} catch (SQLFeatureNotSupportedException e) {\n    Object key = rs.getObject(1);\n}","preventionTips":["Register SQLXML type handlers only for XML-typed SELECT columns.","Read generated keys immediately with typed getters and close the result set.","Keep a shared, audited helper for generated-key retrieval across the codebase."],"tags":["jdbc","shardingsphere","generated-keys","sqlxml","unsupported-operation"],"backgroundTag":null,"analyzedSha":"e952770a215630a3659c75d64369168cd3e26b82","analyzedAt":"2026-08-14T13:54:53.392Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}