{"record":{"id":"1925f551e31634d8","repo":"hibernate/hibernate-orm","slug":"param-named-property-is-required-for-foreign-id","errorCode":null,"errorMessage":"param named \"property\" is required for foreign id generation strategy","messagePattern":"param named \"property\" is required for foreign id generation strategy","errorType":"exception","errorClass":"MappingException","httpStatus":null,"severity":"error","filePath":"hibernate-core/src/main/java/org/hibernate/id/ForeignGenerator.java","lineNumber":74,"sourceCode":"\n\t/**\n\t * Getter for property 'role'.  Role is the {@link #getPropertyName property name} qualified by the\n\t * {@link #getEntityName entity name}.\n\t *\n\t * @return Value for property 'role'.\n\t */\n\tpublic String getRole() {\n\t\treturn getEntityName() + '.' + getPropertyName();\n\t}\n\n\n\t@Override\n\tpublic void configure(GeneratorCreationContext creationContext, Properties parameters) throws MappingException {\n\t\tpropertyName = parameters.getProperty( PROPERTY );\n\t\tentityName = parameters.getProperty( ENTITY_NAME );\n\t\tgeneratedType = creationContext.getType().getReturnedClass();\n\t\tif ( propertyName==null ) {\n\t\t\tthrow new MappingException( \"param named \\\"property\\\" is required for foreign id generation strategy\" );\n\t\t}\n\t}\n\n\t@Override\n\tpublic Class<?> getGeneratedType() {\n\t\treturn generatedType;\n\t}\n\n\t@Override\n\tpublic Object generate(SharedSessionContractImplementor sessionImplementor, Object object) {\n\t\treturn getForeignId( entityName, propertyName, sessionImplementor, object );\n\t}\n\n\t@Override\n\tpublic boolean allowAssignedIdentifiers() {\n\t\treturn true;\n\t}\n}","sourceCodeStart":56,"sourceCodeEnd":92,"githubUrl":"https://github.com/hibernate/hibernate-orm/blob/fad1729dce015f908198d57a8d80274a30f905a5/hibernate-core/src/main/java/org/hibernate/id/ForeignGenerator.java#L56-L92","documentation":"Error \"param named \"property\" is required for foreign id generation strategy\" thrown in hibernate/hibernate-orm.","triggerScenarios":"Thrown when a foreign id generator cannot obtain the id from the associated entity.","commonSituations":"Typical situations: missing 'property' param on the foreign generator; the association is null when the id is generated.","solutions":["Add the 'property' parameter to the @GenericGenerator/@JoinFormula configuration naming the association used for foreign id generation."],"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"}