{"record":{"id":"d6919595bfc7c8f4","repo":"hibernate/hibernate-orm","slug":"embeddedtable-only-supported-for-use-on-entity-or-d69195","errorCode":null,"errorMessage":"@EmbeddedTable only supported for use on entity or mapped-superclass","messagePattern":"@EmbeddedTable only supported for use on entity or mapped-superclass","errorType":"exception","errorClass":"AnnotationPlacementException","httpStatus":null,"severity":"error","filePath":"hibernate-core/src/main/java/org/hibernate/boot/model/internal/ComponentPropertyHolder.java","lineNumber":141,"sourceCode":"\t\t\tMetadataBuildingContext buildingContext) {\n\t\tTable tableToUse = container.getTable();\n\t\tboolean wasExplicit =\n\t\t\t\tcontainer instanceof ComponentPropertyHolder componentPropertyHolder\n\t\t\t\t\t\t&& componentPropertyHolder.getComponent().wasTableExplicitlyDefined();\n\n\t\tfinal var attributeMember = propertyData.getAttributeMember();\n\t\tif ( attributeMember != null ) {\n\t\t\tfinal var embeddedTableAnn = attributeMember.getDirectAnnotationUsage( EmbeddedTable.class );\n\t\t\t// we only allow this when done for an embedded on an entity or mapped-superclass\n\t\t\tif ( container instanceof ClassPropertyHolder ) {\n\t\t\t\tif ( embeddedTableAnn != null ) {\n\t\t\t\t\ttableToUse = resolveEmbeddedTable( container, buildingContext, embeddedTableAnn );\n\t\t\t\t\twasExplicit = true;\n\t\t\t\t}\n\t\t\t}\n\t\t\telse if ( embeddedTableAnn != null ) {\n\t\t\t\t// not allowed\n\t\t\t\tthrow new AnnotationPlacementException(\n\t\t\t\t\t\t\"@EmbeddedTable only supported for use on entity or mapped-superclass\" );\n\t\t\t}\n\t\t}\n\t\tif ( attributeMember != null && container instanceof ClassPropertyHolder ) {\n\t\t\tfinal var embeddedTableAnn = attributeMember.getDirectAnnotationUsage( EmbeddedTable.class );\n\t\t\tif ( embeddedTableAnn != null ) {\n\t\t\t\ttableToUse = resolveEmbeddedTable( container, buildingContext, embeddedTableAnn );\n\t\t\t\twasExplicit = true;\n\t\t\t}\n\t\t}\n\n\t\tcomponent.setTable( tableToUse, wasExplicit );\n\t}\n\n\tprivate static Table resolveEmbeddedTable(\n\t\t\tPropertyHolder container, MetadataBuildingContext buildingContext, EmbeddedTable embeddedTableAnn) {\n\t\tfinal Identifier tableNameIdentifier =\n\t\t\t\tbuildingContext.getObjectNameNormalizer()","sourceCodeStart":123,"sourceCodeEnd":159,"githubUrl":"https://github.com/hibernate/hibernate-orm/blob/fad1729dce015f908198d57a8d80274a30f905a5/hibernate-core/src/main/java/org/hibernate/boot/model/internal/ComponentPropertyHolder.java#L123-L159","documentation":"Error \"@EmbeddedTable only supported for use on entity or mapped-superclass\" 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":["Move @EmbeddedTable onto an entity or mapped-superclass, or remove it from the unsupported target."],"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"}