{"record":{"id":"1f75f8bf4661516a","repo":"hibernate/hibernate-orm","slug":"unsupported-jdbctype-nested-in-json","errorCode":null,"errorMessage":"Unsupported JdbcType nested in JSON: {}","messagePattern":"Unsupported JdbcType nested in JSON: (.+?)","errorType":"exception","errorClass":"UnsupportedOperationException","httpStatus":null,"severity":"error","filePath":"hibernate-core/src/main/java/org/hibernate/type/format/OsonDocumentWriter.java","lineNumber":246,"sourceCode":"\t\t\tcase SqlTypes.DURATION:\n\t\t\tcase SqlTypes.UUID:\n\t\t\t\tgenerator.write( javaType.toString( (T)value ) );\n\t\t\t\tbreak;\n\t\t\tcase SqlTypes.BINARY:\n\t\t\tcase SqlTypes.VARBINARY:\n\t\t\tcase SqlTypes.LONGVARBINARY:\n\t\t\tcase SqlTypes.LONG32VARBINARY:\n\t\t\tcase SqlTypes.BLOB:\n\t\t\tcase SqlTypes.MATERIALIZED_BLOB:\n\t\t\t\t// how to handle\n\t\t\t\tbyte[] bytes = javaType.unwrap( (T)value, byte[].class, options );\n\t\t\t\tgenerator.write( bytes );\n\t\t\t\tbreak;\n\t\t\tcase SqlTypes.ARRAY:\n\t\t\tcase SqlTypes.JSON_ARRAY:\n\t\t\t\tthrow new IllegalStateException( \"array case should be treated at upper level\" );\n\t\t\tdefault:\n\t\t\t\tthrow new UnsupportedOperationException( \"Unsupported JdbcType nested in JSON: \" + jdbcType );\n\t\t}\n\n\t}\n\n}\n","sourceCodeStart":228,"sourceCodeEnd":252,"githubUrl":"https://github.com/hibernate/hibernate-orm/blob/fad1729dce015f908198d57a8d80274a30f905a5/hibernate-core/src/main/java/org/hibernate/type/format/OsonDocumentWriter.java#L228-L252","documentation":"OsonDocumentWriter.serializeValue only renders JDBC type codes it knows for Oracle OSON leaves: tinyint/smallint/integer (plus implicit Boolean/Enum-ordinal), boolean, bit, bigint, float/real/double, char/varchar/clob families and named enums (as strings), date, time variants (as strings), timestamp variants, numeric/decimal, duration/uuid (as strings), and the binary family. Every other nested JdbcType reaches default and throws UnsupportedOperationException 'Unsupported JdbcType nested in JSON: ' + jdbcType.","triggerScenarios":"An Oracle JSON aggregate whose embeddable contains an attribute resolving to an unrenderable JDBC type - e.g. SqlTypes.GEOMETRY/SqlTypes.SQLXML/SqlTypes.INTERVAL_SECOND or a custom JdbcType - written through the OSON path during flush.","commonSituations":"Spatial or XML-carrying embeddables reused inside JSON columns on Oracle; custom JdbcType contributions inside aggregates; dialect-native types leaking into JSON-mapped structures.","solutions":["Force the nested attribute to a representable code, usually @JdbcTypeCode(SqlTypes.VARCHAR) storing a string form (e.g. WKT for geometry)","Remove the unsupported field from the JSON-mapped embeddable or mark it @Transient and store it in its own column","Keep native/exotic types out of aggregates mapped to JSON on Oracle"],"exampleFix":"// before\n@Embeddable\nclass GeometryAttr {\n    @JdbcTypeCode(SqlTypes.GEOMETRY)\n    private Point location; // -> 'Unsupported JdbcType nested in JSON'\n}\n\n// after\n@Embeddable\nclass GeometryAttr {\n    @JdbcTypeCode(SqlTypes.VARCHAR)\n    private String locationWkt; // 'POINT(1 2)' stored as a JSON string\n}","handlingStrategy":"validation","validationCode":"// Verify every field of embeddables used in Oracle JSON aggregates maps to a writer-supported code\nswitch (fieldJdbcType.getDefaultSqlTypeCode()) {\n    case SqlTypes.SQLXML: case SqlTypes.GEOMETRY: case SqlTypes.GEOGRAPHY:\n    case SqlTypes.INTERVAL_SECOND: case SqlTypes.INTERVAL_YEAR_MONTH:\n        throw new IllegalStateException(\"Field \" + field + \" uses a JDBC type OsonDocumentWriter cannot render\");\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Keep Oracle JSON aggregates limited to string/numeric/boolean/temporal/binary/uuid fields","Force exotic nested attributes to @JdbcTypeCode(SqlTypes.VARCHAR)","Add an Oracle round-trip test for every aggregate mapping"],"tags":["hibernate","oracle","oson","json","jdbc-type","serialization"],"backgroundTag":"json-nested-jdbc-type-unsupported","analyzedSha":"fad1729dce015f908198d57a8d80274a30f905a5","analyzedAt":"2026-08-22T04:13:57.527Z","schemaVersion":2},"datasetVersion":"2026-08-22T09:17:25.309Z"}