{"record":{"id":"a5db0f83794cd6ff","repo":"hibernate/hibernate-orm","slug":"support-for-mapping-type-not-yet-implemented","errorCode":null,"errorMessage":"Support for mapping type not yet implemented: ","messagePattern":"Support for mapping type not yet implemented: ","errorType":"exception","errorClass":"UnsupportedOperationException","httpStatus":null,"severity":"error","filePath":"hibernate-core/src/main/java/org/hibernate/type/descriptor/jdbc/spi/JsonGeneratingVisitor.java","lineNumber":185,"sourceCode":"\t\t\t\t\t\t\telementJdbcType,\n\t\t\t\t\t\t\tdomainValue,\n\t\t\t\t\t\t\toptions,\n\t\t\t\t\t\t\twriter\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t\twriter.endArray();\n\t\t\t}\n\t\t\telse {\n\t\t\t\twriter.serializeJsonValue(\n\t\t\t\t\t\tbasicType.convertToRelationalValue( value ),\n\t\t\t\t\t\tbasicType.getJdbcJavaType(),\n\t\t\t\t\t\tbasicType.getJdbcType(),\n\t\t\t\t\t\toptions\n\t\t\t\t);\n\t\t\t}\n\t\t}\n\t\telse {\n\t\t\tthrow new UnsupportedOperationException(\n\t\t\t\t\t\"Support for mapping type not yet implemented: \" + mappedType.getClass().getName()\n\t\t\t);\n\t\t}\n\t}\n\n\t/**\n\t * Checks the provided {@code value} is either null or a lazy property.\n\t *\n\t * @param value the value to check\n\t * @param writer the current {@link JsonDocumentWriter}\n\t * @return {@code true} if it was, indicating no further processing of the value is needed, {@code false otherwise}.\n\t */\n\tprotected boolean handleNullOrLazy(Object value, JsonDocumentWriter writer) {\n\t\tif ( value == null ) {\n\t\t\twriter.nullValue();\n\t\t\treturn true;\n\t\t}\n\t\telse {","sourceCodeStart":167,"sourceCodeEnd":203,"githubUrl":"https://github.com/hibernate/hibernate-orm/blob/fad1729dce015f908198d57a8d80274a30f905a5/hibernate-core/src/main/java/org/hibernate/type/descriptor/jdbc/spi/JsonGeneratingVisitor.java#L167-L203","documentation":"JsonGeneratingVisitor.visit() is the recursive serializer Hibernate uses to turn mapped values into JSON for aggregate (jsonb/OSON) mappings. It handles exactly three shapes: EntityMappingType (serialized as its identifier only), ManagedMappingType (embeddables flattened to a JSON object), and BasicType (scalars, or ArrayJdbcType plurals via visitBasicPluralValues/visitPluralAggregateValues). Any other MappingType implementation falls through to an UnsupportedOperationException naming the mapping type class - Hibernate has no JSON representation for it.","triggerScenarios":"A JSON aggregate attribute whose sub-part exposes a MappingType that is none of the three handled shapes - e.g. a custom MappingType/ValuedModelPart contributed by an integration, or a mapping kind introduced by a newer Hibernate version that this visitor build has not learned, reached via serializeModelPart -> modelPart.getMappedType().","commonSituations":"Third-party or in-house extensions of Hibernate's runtime mapping model; incubating JSON aggregate features across version upgrades; unusual identifier or special-purpose mappings routed through the visitor during aggregate writes.","solutions":["Map the offending attribute as a basic type (String plus an AttributeConverter) so visit() takes the BasicType branch","Restructure the aggregate so it contains only basic and embeddable parts","Upgrade Hibernate ORM - visitor coverage grows between releases","If you own the extension, subclass JsonGeneratingVisitor (protected constructor, replaceable INSTANCE) or report the mapping type class in a Hibernate JIRA issue"],"exampleFix":"// before\n@Embedded\n@JdbcTypeCode(SqlTypes.JSON)\nprivate MyAgg data; // MyAgg contains an attribute with a custom MappingType\n\n// after: serialize the exotic part as a basic String\n@Embeddable\nclass MyAgg {\n    @JdbcTypeCode(SqlTypes.VARCHAR)\n    private String exoticPart; // custom MappingType replaced by converter-backed String\n}","handlingStrategy":"validation","validationCode":"// Build-time smoke test: persist a sample of every JSON-aggregate-mapped entity\ntry (Session s = sessionFactory.openSession()) {\n    Transaction tx = s.beginTransaction();\n    for (Class<?> e : jsonMappedEntities) { s.persist(sampleOf(e)); s.flush(); }\n    tx.rollback();\n} // UnsupportedOperationException('Support for mapping type') fails the build, not production","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Keep JSON aggregates limited to basic and embeddable parts","Re-run the aggregate smoke test after every Hibernate upgrade","Log the mappedType class from the exception to identify the offending attribute quickly"],"tags":["hibernate","json","unsupported-operation","aggregate-mapping","orm-mapping"],"backgroundTag":"unsupported-mapping-type","analyzedSha":"fad1729dce015f908198d57a8d80274a30f905a5","analyzedAt":"2026-08-22T04:13:57.527Z","schemaVersion":2},"datasetVersion":"2026-08-22T09:17:25.309Z"}