{"record":{"id":"2015da41fa6f3c3d","repo":"hibernate/hibernate-orm","slug":"property-getpath-holder-data-is-anno","errorCode":null,"errorMessage":"Property '\" + getPath( holder, data ) + \"' is annotated '@Parent' but is not a member of an embeddable class","messagePattern":"Property '\" \\+ getPath\\( holder, data \\) \\+ \"' is annotated '@Parent' but is not a member of an embeddable class","errorType":"exception","errorClass":"AnnotationException","httpStatus":null,"severity":"error","filePath":"hibernate-core/src/main/java/org/hibernate/boot/model/internal/PropertyBinder.java","lineNumber":849,"sourceCode":"\t\t\t\t\t\tinSecondPass,\n\t\t\t\t\t\tcontext,\n\t\t\t\t\t\tinheritanceStatePerClass\n\t\t\t\t);\n\t\t\t}\n\t\t}\n\t}\n\n\tprivate static boolean alreadyProcessedBySuper(PropertyHolder holder, PropertyData data, EntityBinder binder) {\n\t\treturn !holder.isComponent()\n\t\t\t&& binder.isPropertyDefinedInSuperHierarchy( data.getPropertyName() );\n\t}\n\n\tprivate static void handleParentProperty(PropertyHolder holder, PropertyData data, MemberDetails property) {\n\t\tif ( holder.isComponent() ) {\n\t\t\tholder.setParentProperty( property.resolveAttributeName() );\n\t\t}\n\t\telse {\n\t\t\tthrow new AnnotationException( \"Property '\" + getPath( holder, data )\n\t\t\t\t\t+ \"' is annotated '@Parent' but is not a member of an embeddable class\" );\n\t\t}\n\t}\n\n\tprivate static void buildProperty(\n\t\t\tPropertyHolder propertyHolder,\n\t\t\tNullability nullability,\n\t\t\tPropertyData inferredData,\n\t\t\tEntityBinder entityBinder,\n\t\t\tboolean isIdentifierMapper,\n\t\t\tboolean isComponentEmbedded,\n\t\t\tboolean inSecondPass,\n\t\t\tMetadataBuildingContext context,\n\t\t\tMap<ClassDetails, InheritanceState> inheritanceStatePerClass) {\n\n\t\tfinal var memberDetails = inferredData.getAttributeMember();\n\n\t\tif ( isPropertyOfRegularEmbeddable( propertyHolder, isComponentEmbedded )","sourceCodeStart":831,"sourceCodeEnd":867,"githubUrl":"https://github.com/hibernate/hibernate-orm/blob/fad1729dce015f908198d57a8d80274a30f905a5/hibernate-core/src/main/java/org/hibernate/boot/model/internal/PropertyBinder.java#L831-L867","documentation":"@Parent is a Hibernate-specific annotation that marks a back-reference from an embeddable to its owning entity. It is only meaningful when the property holder is a component/embeddable; on a regular entity or plain class there is no parent to bind, so PropertyBinder throws AnnotationException.","triggerScenarios":"@Parent on a field of an @Entity or a non-embeddable class; moving a field with @Parent out of the embeddable during refactoring; using @Parent intending JPA semantics (it is not a JPA annotation) on an entity relationship.","commonSituations":"Refactoring embeddables and accidentally relocating the back-reference field; misunderstanding @Parent as a parent-child association annotation; migrating embeddable classes between projects where the holder class lost its @Embeddable usage.","solutions":["Remove @Parent from the property, or move the property (with @Parent) back into the @Embeddable class.","For a real entity-to-entity reference, use @ManyToOne instead of @Parent.","Verify the holder class is actually used as an embeddable (via @Embedded/@EmbeddedId somewhere)."],"exampleFix":"// before: @Parent used on an entity property\n@Entity\npublic class Address {\n    @Parent                 // wrong: holder is not an embeddable\n    private Person owner;\n}\n\n// after: proper use inside an embeddable\n@Embeddable\npublic class Address {\n    @Parent\n    private Person owner;   // back-reference to the owning entity\n}\n@Entity\npublic class Person {\n    @Embedded\n    private Address address;\n}","handlingStrategy":"validation","validationCode":"// @Parent only inside embeddables\nfor (Class<?> entity : annotatedClasses) {\n    if (!entity.isAnnotationPresent(Embeddable.class)) {\n        for (Field f : entity.getDeclaredFields()) {\n            if (f.isAnnotationPresent(Parent.class)) {\n                throw new IllegalStateException(\"@Parent on non-embeddable holder: \" + f);\n            }\n        }\n    }\n}","typeGuard":"static boolean isValidParentHolder(Class<?> holder) {\n    return holder.isAnnotationPresent(Embeddable.class);\n}","tryCatchPattern":"try {\n    SessionFactory sf = cfg.buildSessionFactory();\n} catch (AnnotationException e) {\n    throw new IllegalStateException(\"@Parent misuse: \" + e.getMessage(), e);\n}","preventionTips":["Remember @Parent is Hibernate-specific and embeddable-only","Use @ManyToOne for entity-to-entity references"],"tags":["hibernate","parent-annotation","embeddable","annotation-misuse","bootstrap"],"backgroundTag":"hibernate-parent-annotation-misplaced","analyzedSha":"fad1729dce015f908198d57a8d80274a30f905a5","analyzedAt":"2026-08-22T04:13:57.527Z","schemaVersion":2},"datasetVersion":"2026-08-22T09:17:25.309Z"}