{"record":{"id":"8c83c18878f21931","repo":"hibernate/hibernate-orm","slug":"property-propertyname-of-path-is-annotated","errorCode":null,"errorMessage":"Property '<propertyName>' of '<path>' is annotated '@GeneratedValue' but is not part of an identifier","messagePattern":"Property '<propertyName>' of '<path>' is annotated '@GeneratedValue' but is not part of an identifier","errorType":"exception","errorClass":"AnnotationException","httpStatus":null,"severity":"error","filePath":"hibernate-core/src/main/java/org/hibernate/boot/model/internal/EmbeddableBinder.java","lineNumber":599,"sourceCode":"\t\t\tPropertyData propertyAnnotatedElement, PropertyHolder subholder,\n\t\t\tComponent embeddable,\n\t\t\tMetadataBuildingContext context) {\n\t\tfinal var memberDetails = propertyAnnotatedElement.getAttributeMember();\n\t\tif ( isIdClass || subholder.isOrWithinEmbeddedId() ) {\n\t\t\tfinal var property = findProperty( embeddable, propertyAnnotatedElement.getPropertyName() );\n\t\t\tif ( property != null ) {\n\t\t\t\t// Identifier properties are always simple values\n\t\t\t\tfinal var value = (SimpleValue) property.getValue();\n\t\t\t\tcreateIdGeneratorsFromGeneratorAnnotations(\n\t\t\t\t\t\tsubholder,\n\t\t\t\t\t\tpropertyAnnotatedElement,\n\t\t\t\t\t\tvalue,\n\t\t\t\t\t\tcontext\n\t\t\t\t);\n\t\t\t}\n\t\t}\n\t\telse if ( memberDetails.hasDirectAnnotationUsage( GeneratedValue.class ) ) {\n\t\t\tthrow new AnnotationException(\n\t\t\t\t\t\"Property '\" + memberDetails.getName() + \"' of '\"\n\t\t\t\t\t\t\t+ getPath( propertyHolder, inferredData )\n\t\t\t\t\t\t\t+ \"' is annotated '@GeneratedValue' but is not part of an identifier\" );\n\t\t}\n\t}\n\n\tprivate static Property findProperty(Component embeddable, String name) {\n\t\tfor ( var property : embeddable.getProperties() ) {\n\t\t\tif ( property.getName().equals( name ) ) {\n\t\t\t\treturn property;\n\t\t\t}\n\t\t}\n\t\treturn null;\n\t}\n\n\tprivate static CompositeUserType<?> compositeUserType(\n\t\t\tClass<? extends CompositeUserType<?>> compositeUserTypeClass,\n\t\t\tMetadataBuildingContext context) {","sourceCodeStart":581,"sourceCodeEnd":617,"githubUrl":"https://github.com/hibernate/hibernate-orm/blob/fad1729dce015f908198d57a8d80274a30f905a5/hibernate-core/src/main/java/org/hibernate/boot/model/internal/EmbeddableBinder.java#L581-L617","documentation":"Error \"Property '<propertyName>' of '<path>' is annotated '@GeneratedValue' but is not part of an identifier\" thrown in hibernate/hibernate-orm.","triggerScenarios":"An identifier/value generator declaration is inconsistent with the referenced generator or the annotated element.","commonSituations":"@GeneratedValue pointing at a generator of the wrong kind (SEQUENCE vs TABLE), a missing named generator, too many generator annotations, or an unsupported generation strategy for @CollectionId.","solutions":["Remove @GeneratedValue from the non-identifier property of the embeddable.","Or restructure so the generated property is the entity identifier."],"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"}