{"record":{"id":"a90f582ba05e8fa4","repo":"hibernate/hibernate-orm","slug":"unsupportd-source-type","errorCode":null,"errorMessage":"Unsupportd source type ","messagePattern":"Unsupportd source type ","errorType":"exception","errorClass":"UnsupportedOperationException","httpStatus":null,"severity":"error","filePath":"hibernate-core/src/main/java/org/hibernate/type/format/FormatMapper.java","lineNumber":70,"sourceCode":"\tdefault boolean supportsSourceType(Class<?> sourceType) {\n\t\treturn false;\n\t};\n\n\t/**\n\t * Checks that this mapper supports a type as a target type.\n\t * @param targetType the target type\n\t * @return <code>true</code> if the type is supported, false otherwise.\n\t */\n\tdefault boolean supportsTargetType(Class<?> targetType) {\n\t\treturn false;\n\t}\n\n\tdefault <T> void writeToTarget(T value, JavaType<T> javaType, Object target, WrapperOptions options) throws IOException {\n\t\tthrow new UnsupportedOperationException( \"Unsupportd target type \" + target.getClass() );\n\t};\n\n\tdefault <T> T readFromSource(JavaType<T> javaType, Object source, WrapperOptions options) throws IOException {\n\t\tthrow new UnsupportedOperationException( \"Unsupportd source type \" + source.getClass() );\n\t};\n}\n","sourceCodeStart":52,"sourceCodeEnd":73,"githubUrl":"https://github.com/hibernate/hibernate-orm/blob/fad1729dce015f908198d57a8d80274a30f905a5/hibernate-core/src/main/java/org/hibernate/type/format/FormatMapper.java#L52-L73","documentation":"FormatMapper.readFromSource is the streaming-read counterpart of writeToTarget: it deserializes an aggregate directly from a source object (e.g. Oracle's OracleJsonParser for binary OSON), with supportsSourceType advertising capability. The default implementation throws UnsupportedOperationException 'Unsupportd source type ' + source.getClass() (typo present in Hibernate's message) when the configured mapper does not override it for that source type.","triggerScenarios":"The ORM reads a JSON aggregate from a non-CharSequence source while the configured FormatMapper only implements fromString - e.g. Oracle OSON handing an OracleJsonParser to a Jackson-based custom mapper, or a custom FormatMapper that predates the readFromSource API.","commonSituations":"Custom FormatMapper registrations (hibernate.type.json_format_mapper) that only implemented the string API; Oracle binary JSON columns with a third-party mapper; upgrading Hibernate versions where reads switched to readFromSource.","solutions":["Override readFromSource (and supportsSourceType) in your FormatMapper for the source types Hibernate passes","Use the built-in mapper matching the source - the Oracle OSON mapper for OracleJsonParser, Jackson mapper for String/Reader","Keep the format mapper configuration aligned with the dialect's JSON storage format"],"exampleFix":"// before\nFormatMapper mapper = new JacksonJsonFormatMapper(); // supports only CharSequence sources\n// Oracle OSON read path hands over OracleJsonParser -> 'Unsupportd source type'\n\n// after\nSessionFactoryBuilder cfg = ...;\ncfg.applyJsonFormatMapper(new OsonFormatMapper()); // built-in mapper that reads OracleJsonParser","handlingStrategy":"validation","validationCode":"FormatMapper mapper = sessionFactory.getSessionFactoryOptions().getJsonFormatMapper();\nif (!mapper.supportsSourceType(OracleJsonParser.class)) {\n    // fall back to string-based reading\n    T v = mapper.fromString((CharSequence) stringSource, javaType, options);\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Implement supportsSourceType alongside readFromSource in custom FormatMappers","Match the format mapper to the dialect's JSON storage (OSON vs string)","Cover Oracle binary JSON reads in integration tests when using custom mappers"],"tags":["hibernate","json","format-mapper","oracle","oson","configuration"],"backgroundTag":"json-format-mapper-unsupported-source","analyzedSha":"fad1729dce015f908198d57a8d80274a30f905a5","analyzedAt":"2026-08-22T04:13:57.527Z","schemaVersion":2},"datasetVersion":"2026-08-22T09:17:25.309Z"}