{"record":{"id":"627ed99f4601688a","repo":"hibernate/hibernate-orm","slug":"unknown-representationmode","errorCode":null,"errorMessage":"Unknown RepresentationMode","messagePattern":"Unknown RepresentationMode","errorType":"exception","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"hibernate-core/src/main/java/org/hibernate/metamodel/RepresentationMode.java","lineNumber":33,"sourceCode":" */\npublic enum RepresentationMode {\n\tPOJO,\n\tMAP;\n\n\tpublic String getExternalName() {\n\t\treturn switch ( this ) {\n\t\t\tcase POJO -> \"pojo\";\n\t\t\tcase MAP -> \"dynamic-map\";\n\t\t};\n\t}\n\n\tpublic static RepresentationMode fromExternalName(String externalName) {\n\t\treturn externalName == null\n\t\t\t\t? POJO\n\t\t\t\t: switch ( externalName.toLowerCase( Locale.ROOT ) ) {\n\t\t\t\t\tcase \"pojo\" -> POJO;\n\t\t\t\t\tcase \"dynamic-map\", \"map\" -> MAP;\n\t\t\t\t\tdefault -> throw new IllegalArgumentException( \"Unknown RepresentationMode\" );\n\t\t\t\t};\n\t}\n}\n","sourceCodeStart":15,"sourceCodeEnd":37,"githubUrl":"https://github.com/hibernate/hibernate-orm/blob/fad1729dce015f908198d57a8d80274a30f905a5/hibernate-core/src/main/java/org/hibernate/metamodel/RepresentationMode.java#L15-L37","documentation":"RepresentationMode.fromExternalName converts the string used in mappings/configuration into the POJO or MAP (dynamic-map) representation enum. Null yields POJO; recognized names are \"pojo\", \"dynamic-map\" and \"map\". Any other string falls through the switch and raises IllegalArgumentException(\"Unknown RepresentationMode\"), surfacing at mapping parse/boot time.","triggerScenarios":"hbm.xml declaring an invalid representation/entity-mode value (e.g. representation=\"dom4j\" or representation=\"dynamicMap\" instead of \"dynamic-map\"), parsed through RepresentationModeConverter; programmatic callers passing arbitrary user-supplied strings to RepresentationMode.fromExternalName.","commonSituations":"Legacy Hibernate 3 configurations using entity-mode=\"dom4j\" (removed after Hibernate 5); typos like \"dynamic_map\"/\"map-based\"/\"pojos\" in hand-edited XML; config generated by templates with the wrong casing/separator; upgrading old projects whose hbm.xml still carries stale entity-mode attributes.","solutions":["Set the attribute to a supported value: representation=\"pojo\" or representation=\"dynamic-map\" (legacy alias \"map\" also accepted).","Remove the obsolete dom4j representation entirely — it is unsupported; map XML payloads as basic types instead.","If the value comes from user config, validate it against {\"pojo\",\"dynamic-map\",\"map\"} before bootstrapping and fail with a helpful message.","Search the project for representation= / entity-mode= to catch all occurrences."],"exampleFix":"<!-- before -->\n<hibernate-mapping>\n  <class entity-name=\"Item\" representation=\"dom4j\">...</class>\n</hibernate-mapping>\n\n<!-- after -->\n<hibernate-mapping>\n  <class entity-name=\"Item\" representation=\"dynamic-map\">...</class>\n</hibernate-mapping>","handlingStrategy":"validation","validationCode":"Set<String> VALID = Set.of(\"pojo\", \"dynamic-map\", \"map\");\nString mode = config.get(\"hibernate.entity.mode\");\nif (mode != null && !VALID.contains(mode.toLowerCase(Locale.ROOT))) {\n    throw new IllegalArgumentException(\"representation must be one of \" + VALID + \": \" + mode);\n}","typeGuard":"static boolean isValidRepresentationName(String name) {\n    return name == null || Set.of(\"pojo\", \"dynamic-map\", \"map\").contains(name.toLowerCase(Locale.ROOT));\n}","tryCatchPattern":null,"preventionTips":["Only use representation/entity-mode values pojo, dynamic-map, or map.","Remove dom4j entity-mode from legacy configs — it was deleted after Hibernate 5.","Validate mapping XML against the hbm XSD so invalid attribute values fail at parse time."],"tags":["hibernate","representation-mode","configuration","hbm-xml","illegal-argument"],"backgroundTag":"invalid-config-value","analyzedSha":"fad1729dce015f908198d57a8d80274a30f905a5","analyzedAt":"2026-08-22T04:13:57.527Z","schemaVersion":2},"datasetVersion":"2026-08-22T09:17:25.309Z"}