{"record":{"id":"36e69f15ef745b8b","repo":"apache/shardingsphere","slug":"getobject-with-type-cannot-convert-s-s-to-s","errorCode":null,"errorMessage":"getObject with type, cannot convert %s:%s to %s","messagePattern":"getObject with type, cannot convert (.+?):(.+?) to (.+?)","errorType":"exception","errorClass":"SQLFeatureNotSupportedException","httpStatus":null,"severity":"error","filePath":"infra/executor/src/main/java/org/apache/shardingsphere/infra/executor/sql/execute/result/query/impl/driver/jdbc/type/util/ResultSetUtils.java","lineNumber":112,"sourceCode":"        if (value instanceof byte[]) {\n            return convertByteArrayValue((byte[]) value, convertType);\n        }\n        if (String.class.equals(convertType)) {\n            return value.toString();\n        }\n        if (value instanceof String) {\n            Optional<Object> result = convertStringValue((String) value, convertType);\n            if (result.isPresent()) {\n                return result.get();\n            }\n        }\n        if (boolean.class.equals(convertType)) {\n            return convertBooleanValue(value);\n        }\n        try {\n            return convertType.cast(value);\n        } catch (final ClassCastException ignored) {\n            throw new SQLFeatureNotSupportedException(\"getObject with type, cannot convert \" + value.getClass().getName() + \":\" + value + \" to \" + convertType.getName());\n        }\n    }\n    \n    private static Optional<Object> convertStringValue(final String value, final Class<?> convertType) {\n        if (byte[].class.equals(convertType)) {\n            return Optional.of(value.getBytes(StandardCharsets.UTF_8));\n        }\n        if (Timestamp.class.equals(convertType)) {\n            TemporalAccessor temporalAccessor = LOOSE_DATE_TIME_FORMATTER.parseBest(value, LocalDateTime::from, LocalDate::from);\n            LocalDateTime localDateTime = (temporalAccessor instanceof LocalDateTime) ? (LocalDateTime) temporalAccessor : ((LocalDate) temporalAccessor).atStartOfDay();\n            return Optional.of(Timestamp.valueOf(localDateTime));\n        }\n        if (java.sql.Date.class.equals(convertType)) {\n            return Optional.of(java.sql.Date.valueOf(LocalDate.from(LOOSE_DATE_TIME_FORMATTER.parse(value))));\n        }\n        if (Time.class.equals(convertType)) {\n            return Optional.of(Time.valueOf(LocalTime.from(LOOSE_DATE_TIME_FORMATTER.parse(value))));\n        }","sourceCodeStart":94,"sourceCodeEnd":130,"githubUrl":"https://github.com/apache/shardingsphere/blob/e952770a215630a3659c75d64369168cd3e26b82/infra/executor/src/main/java/org/apache/shardingsphere/infra/executor/sql/execute/result/query/impl/driver/jdbc/type/util/ResultSetUtils.java#L94-L130","documentation":"Error \"getObject with type, cannot convert %s:%s to %s\" thrown in apache/shardingsphere.","triggerScenarios":"ResultSetUtils.getObject with an explicit type cannot convert the column value to the requested Java type.","commonSituations":"Requesting a Java type with no defined mapping from the column's JDBC type, e.g. converting a numeric column to a struct type.","solutions":["Call getObject with a Java type compatible with the column's SQL type.","Use the driver-specific conversion (e.g. getString, getTimestamp) appropriate for the column.","Check the database type of the column and map it to a supported Java type."],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"e952770a215630a3659c75d64369168cd3e26b82","analyzedAt":"2026-08-14T13:54:53.392Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}