{"record":{"id":"aab93a33c12f0910","repo":"hibernate/hibernate-orm","slug":"property-path-is-annotated-generatedvalue-b","errorCode":null,"errorMessage":"Property '<path>' is annotated '@GeneratedValue' but is not part of an identifier","messagePattern":"Property '<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/EntityBinder.java","lineNumber":1132,"sourceCode":"\t\t\tInheritanceState inheritanceState,\n\t\t\tMetadataBuildingContext context,\n\t\t\tPropertyHolder propertyHolder,\n\t\t\tSet<String> idPropertiesIfIdClass,\n\t\t\tElementsToProcess elementsToProcess,\n\t\t\tMap<ClassDetails, InheritanceState> inheritanceStates) {\n\t\tfinal Set<String> missingIdProperties = new HashSet<>( idPropertiesIfIdClass );\n\t\tfinal Set<String> missingEntityProperties = new HashSet<>();\n\t\tfor ( var propertyAnnotatedElement : elementsToProcess.getElements() ) {\n\t\t\tfinal String propertyName = propertyAnnotatedElement.getPropertyName();\n\t\t\tif ( !idPropertiesIfIdClass.contains( propertyName ) ) {\n\t\t\t\tfinal var memberDetails = propertyAnnotatedElement.getAttributeMember();\n\t\t\t\tfinal boolean hasIdAnnotation = hasIdAnnotation( memberDetails );\n\t\t\t\tif ( !idPropertiesIfIdClass.isEmpty() && !isIgnoreIdAnnotations() && hasIdAnnotation ) {\n\t\t\t\t\tmissingEntityProperties.add( propertyName );\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\tif ( !hasIdAnnotation && memberDetails.hasAnnotationUsage( GeneratedValue.class, modelsContext() ) ) {\n\t\t\t\t\t\tthrow new AnnotationException( \"Property '\" + getPath( propertyHolder, propertyAnnotatedElement )\n\t\t\t\t\t\t\t\t\t\t\t\t+ \"' is annotated '@GeneratedValue' but is not part of an identifier\" );\n\t\t\t\t\t}\n\t\t\t\t\tprocessElementAnnotations(\n\t\t\t\t\t\t\tpropertyHolder,\n\t\t\t\t\t\t\tgetNullability( inheritanceState, memberDetails ),\n\t\t\t\t\t\t\tpropertyAnnotatedElement,\n\t\t\t\t\t\t\tthis,\n\t\t\t\t\t\t\tfalse,\n\t\t\t\t\t\t\tfalse,\n\t\t\t\t\t\t\tfalse,\n\t\t\t\t\t\t\tcontext,\n\t\t\t\t\t\t\tinheritanceStates\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t}\n\t\t\telse {\n\t\t\t\tmissingIdProperties.remove( propertyName );\n\t\t\t}","sourceCodeStart":1114,"sourceCodeEnd":1150,"githubUrl":"https://github.com/hibernate/hibernate-orm/blob/fad1729dce015f908198d57a8d80274a30f905a5/hibernate-core/src/main/java/org/hibernate/boot/model/internal/EntityBinder.java#L1114-L1150","documentation":"Error \"Property '<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, or make the property part of the 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"}