{"record":{"id":"c5df3b76409a4584","repo":"apache/shardingsphere","slug":"gettime","errorCode":null,"errorMessage":"getTime","messagePattern":"getTime","errorType":"exception","errorClass":"SQLFeatureNotSupportedException","httpStatus":null,"severity":"error","filePath":"jdbc/src/main/java/org/apache/shardingsphere/driver/jdbc/unsupported/AbstractUnsupportedGeneratedKeysResultSet.java","lineNumber":72,"sourceCode":"    \n    @Override\n    public final Date getDate(final String columnLabel) throws SQLException {\n        throw new SQLFeatureNotSupportedException(\"getDate\");\n    }\n    \n    @Override\n    public final Date getDate(final int columnIndex, final Calendar cal) throws SQLException {\n        throw new SQLFeatureNotSupportedException(\"getDate\");\n    }\n    \n    @Override\n    public final Date getDate(final String columnLabel, final Calendar cal) throws SQLException {\n        throw new SQLFeatureNotSupportedException(\"getDate\");\n    }\n    \n    @Override\n    public final Time getTime(final int columnIndex) throws SQLException {\n        throw new SQLFeatureNotSupportedException(\"getTime\");\n    }\n    \n    @Override\n    public final Time getTime(final int columnIndex, final Calendar cal) throws SQLException {\n        throw new SQLFeatureNotSupportedException(\"getTime\");\n    }\n    \n    @Override\n    public final Time getTime(final String columnLabel, final Calendar cal) throws SQLException {\n        throw new SQLFeatureNotSupportedException(\"getTime\");\n    }\n    \n    @Override\n    public final Time getTime(final String columnLabel) throws SQLException {\n        throw new SQLFeatureNotSupportedException(\"getTime\");\n    }\n    \n    @Override","sourceCodeStart":54,"sourceCodeEnd":90,"githubUrl":"https://github.com/apache/shardingsphere/blob/e952770a215630a3659c75d64369168cd3e26b82/jdbc/src/main/java/org/apache/shardingsphere/driver/jdbc/unsupported/AbstractUnsupportedGeneratedKeysResultSet.java#L54-L90","documentation":"getTime(int columnIndex) is final and always throws in AbstractUnsupportedGeneratedKeysResultSet. The generated-keys result set returned by the ShardingSphere driver implements only getString/getNumeric/getObject families; java.sql.Time extraction from generated keys is not supported because the underlying values are plain Comparables without temporal semantics.","triggerScenarios":"Calling rs.getTime(1) while iterating the ResultSet from Statement.getGeneratedKeys() after an INSERT via the ShardingSphere driver.","commonSituations":"Entity persisters that map generated key columns to arbitrary Java types including Time. Code reused from a MySQL/PostgreSQL project where getTime on generated keys worked.","solutions":["Read the key with rs.getString(1) and convert with java.sql.Time.valueOf(String) if it is genuinely a time literal.","Use rs.getObject(1) and cast/convert in Java.","Catch SQLFeatureNotSupportedException and fall back to string parsing."],"exampleFix":"// before\nTime t = rs.getTime(1);\n\n// after\nString raw = rs.getString(1);\nTime t = raw == null ? null : java.sql.Time.valueOf(raw);","handlingStrategy":"try-catch","validationCode":"Object key = rs.getObject(1); // decide conversion from runtime type","typeGuard":"static boolean isShardingGeneratedKeys(ResultSet rs) {\n    return rs.getClass().getName().endsWith(\"GeneratedKeysResultSet\");\n}","tryCatchPattern":"try {\n    t = rs.getTime(1);\n} catch (SQLFeatureNotSupportedException e) {\n    String raw = rs.getString(1);\n    t = raw == null ? null : java.sql.Time.valueOf(raw);\n}","preventionTips":["Use string reads plus java.sql.Time.valueOf for time-typed generated keys.","Keep typed temporal getters out of generic generated-key mappers.","Test insert paths with the ShardingSphere driver in CI."],"tags":["jdbc","shardingsphere","generated-keys","resultset","sql-feature-not-supported","time"],"backgroundTag":null,"analyzedSha":"e952770a215630a3659c75d64369168cd3e26b82","analyzedAt":"2026-08-14T13:54:53.392Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}