{"record":{"id":"91aef7b581d537e9","repo":"hibernate/hibernate-orm","slug":"transformation-of-any-as-part-of-join-secon","errorCode":null,"errorMessage":"transformation of <any/> as part of <join/> (secondary-table) not yet implemented","messagePattern":"transformation of <any/> as part of <join/> \\(secondary-table\\) not yet implemented","errorType":"exception","errorClass":"MappingException","httpStatus":null,"severity":"error","filePath":"hibernate-core/src/main/java/org/hibernate/boot/jaxb/hbm/transform/HbmXmlTransformer.java","lineNumber":4352,"sourceCode":"\t\t\t\t\t\t\tbootEntityInfo.getPersistentClass().getEntityName(),\n\t\t\t\t\t\t\thbmComponent,\n\t\t\t\t\t\t\tcomponentTypeInfo\n\t\t\t\t\t);\n\t\t\t\t\tfinal var embedded = componentHandler.transformEmbedded( jaxbEmbeddable, hbmComponent, componentTypeInfo );\n\t\t\t\t\ttransferAccess(\n\t\t\t\t\t\t\thbmComponent.getAccess(),\n\t\t\t\t\t\t\tembedded::setAccess,\n\t\t\t\t\t\t\tembedded::setAttributeAccessor\n\t\t\t\t\t);\n\t\t\t\t\tmappingEntity.getAttributes().getEmbeddedAttributes().add( embedded );\n\t\t\t\t}\n\t\t\t\telse if ( hbmProperty instanceof JaxbHbmManyToOneType hbmManyToOne ) {\n\t\t\t\t\tfinal var propertyInfo = bootEntityInfo.propertyInfoMap().get( hbmManyToOne.getName() );\n\t\t\t\t\tfinal var jaxbManyToOne = transformManyToOne( hbmManyToOne, propertyInfo );\n\t\t\t\t\tmappingEntity.getAttributes().getManyToOneAttributes().add( jaxbManyToOne );\n\t\t\t\t}\n\t\t\t\telse if ( hbmProperty instanceof JaxbHbmAnyAssociationType ) {\n\t\t\t\t\tthrow new MappingException(\n\t\t\t\t\t\t\t\"transformation of <any/> as part of <join/> (secondary-table) not yet implemented\",\n\t\t\t\t\t\t\torigin()\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t\telse if ( hbmProperty instanceof JaxbHbmDynamicComponentType ) {\n\t\t\t\t\thandleUnsupportedContent( \"<dynamic-component/> mappings not supported\" );\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\tprivate void transferSecondaryTable(JaxbHbmSecondaryTableType hbmJoin, JaxbEntityImpl mappingEntity) {\n\t\tfinal var secondaryTable = new JaxbSecondaryTableImpl();\n\t\tsecondaryTable.setCatalog( hbmJoin.getCatalog() );\n\t\tsecondaryTable.setComment( hbmJoin.getComment() );\n\t\tsecondaryTable.setName( hbmJoin.getTable() );\n\t\tsecondaryTable.setSchema( hbmJoin.getSchema() );\n\t\tsecondaryTable.setOptional( hbmJoin.isOptional() );","sourceCodeStart":4334,"sourceCodeEnd":4370,"githubUrl":"https://github.com/hibernate/hibernate-orm/blob/fad1729dce015f908198d57a8d80274a30f905a5/hibernate-core/src/main/java/org/hibernate/boot/jaxb/hbm/transform/HbmXmlTransformer.java#L4334-L4370","documentation":"A MappingException raised by HbmXmlTransformer when a <join> (secondary table) block in hbm.xml contains an <any/> mapping. Secondary-table <any/> transformation is explicitly not implemented; the Origin pinpoints the file and position.","triggerScenarios":"hbm.xml containing <join table=\"...\"> with an <any ...> property inside it, passed through the hbm-to-mapping.xml transformation. Deterministic for that construct.","commonSituations":"Wide legacy tables split across primary/secondary tables where a polymorphic reference landed in the secondary part; bulk migration runs stopping at the first <join> containing <any>.","solutions":["Move the <any> property out of the <join> onto the entity root (main table) if the column actually lives there","If the column truly belongs to the secondary table, keep that mapping as native hbm.xml and exclude it from transformation","Or hand-write the mapping.xml for that entity, mapping the any-property to the secondary table","Or remodel the any-association as a discriminator-based entity relation"],"exampleFix":"<!-- before -->\n<join table=\"entity_ext\">\n    <key column=\"entity_id\"/>\n    <any name=\"owner\" meta-type=\"string\" id-type=\"long\">\n        <column name=\"owner_type\"/>\n        <column name=\"owner_id\"/>\n    </any>\n</join>\n\n<!-- after: any moved to the entity root -->\n<any name=\"owner\" meta-type=\"string\" id-type=\"long\">\n    <column name=\"owner_type\"/>\n    <column name=\"owner_id\"/>\n</any>","handlingStrategy":"validation","validationCode":"// detect <any> nested inside <join> before transforming\nvar joins = doc.getElementsByTagName(\"join\");\nfor (int i = 0; i < joins.getLength(); i++) {\n    var join = (org.w3c.dom.Element) joins.item(i);\n    if (join.getElementsByTagName(\"any\").getLength() > 0) {\n        throw new IllegalStateException(\"<join> '\" + join.getAttribute(\"table\") + \"' contains <any/>: not transformable\");\n    }\n}","typeGuard":null,"tryCatchPattern":"try {\n    transformer.transform(hbmSource);\n} catch (MappingException e) {\n    if (e.getMessage().contains(\"<any/> as part of <join/>\")) {\n        // move the <any> to the entity root, or keep this file as native hbm.xml\n    }\n    throw e;\n}","preventionTips":["Keep <any> properties on the entity root, not inside <join>","Audit secondary-table blocks during migration planning","Hand-write mapping.xml for entities whose joins carry exotic property types"],"tags":["hibernate","hbm-xml","secondary-table","any-mapping","mapping-transformation"],"backgroundTag":"unsupported-orm-mapping-feature","analyzedSha":"fad1729dce015f908198d57a8d80274a30f905a5","analyzedAt":"2026-08-22T04:13:57.527Z","schemaVersion":2},"datasetVersion":"2026-08-22T09:17:25.309Z"}