{"record":{"id":"8df633a7cfe9f473","repo":"hibernate/hibernate-orm","slug":"embeddable-name-has-a-discriminator-of-charact","errorCode":null,"errorMessage":"Embeddable '<name>' has a discriminator of character type and must specify its '@DiscriminatorValue'","messagePattern":"Embeddable '<name>' has a discriminator of character type and must specify its '@DiscriminatorValue'","errorType":"exception","errorClass":"AnnotationException","httpStatus":null,"severity":"error","filePath":"hibernate-core/src/main/java/org/hibernate/boot/model/internal/EmbeddableBinder.java","lineNumber":822,"sourceCode":"\t\t\tBasicType<?> discriminatorType,\n\t\t\tMap<Object, String> discriminatorValues) {\n\t\treturn discriminatorValues.put(\n\t\t\t\tdiscriminatorType.getJavaTypeDescriptor()\n\t\t\t\t\t\t.fromString( discriminatorValue( annotatedClass, discriminatorType ) ),\n\t\t\t\tannotatedClass.getName().intern()\n\t\t);\n\t}\n\n\tprivate static String discriminatorValue(ClassDetails annotatedClass, BasicType<?> discriminatorType) {\n\t\tfinal String explicitValue =\n\t\t\t\tannotatedClass.hasDirectAnnotationUsage( DiscriminatorValue.class )\n\t\t\t\t\t\t? annotatedClass.getDirectAnnotationUsage( DiscriminatorValue.class ).value()\n\t\t\t\t\t\t: null;\n\t\tif ( isBlank( explicitValue ) ) {\n\t\t\tfinal String name = unqualify( annotatedClass.getName() );\n\t\t\treturn switch ( discriminatorType.getName() ) {\n\t\t\t\tcase \"character\" ->\n\t\t\t\t\t\tthrow new AnnotationException( \"Embeddable '\" + name\n\t\t\t\t\t\t\t\t+ \"' has a discriminator of character type and must specify its '@DiscriminatorValue'\" );\n\t\t\t\tcase \"integer\" -> String.valueOf( name.hashCode() );\n\t\t\t\tdefault -> name;\n\t\t\t};\n\t\t}\n\t\telse {\n\t\t\treturn explicitValue;\n\t\t}\n\t}\n\n\tprivate static boolean isValidSuperclass(ClassDetails superClass, boolean isIdClass) {\n\t\tif ( superClass == null ) {\n\t\t\treturn false;\n\t\t}\n\t\telse if ( isMappedSuperclass( superClass ) ) {\n\t\t\treturn true;\n\t\t}\n\t\telse if ( isIdClass ) {","sourceCodeStart":804,"sourceCodeEnd":840,"githubUrl":"https://github.com/hibernate/hibernate-orm/blob/fad1729dce015f908198d57a8d80274a30f905a5/hibernate-core/src/main/java/org/hibernate/boot/model/internal/EmbeddableBinder.java#L804-L840","documentation":"Error \"Embeddable '<name>' has a discriminator of character type and must specify its '@DiscriminatorValue'\" thrown in hibernate/hibernate-orm.","triggerScenarios":"An @Embeddable / @Embedded / @ElementCollection mapping violates an embeddable mapping constraint.","commonSituations":"Embeddables with @Id members, inheritance, recursive composition, or properties split across multiple tables; or @Convert/@EmbeddedTable placed where unsupported.","solutions":["Specify @DiscriminatorValue explicitly on the embeddable with a character-type discriminator."],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"fad1729dce015f908198d57a8d80274a30f905a5","analyzedAt":"2026-08-22T04:13:57.527Z","schemaVersion":2},"datasetVersion":"2026-08-22T09:17:25.309Z"}