hibernate/hibernate-orm · error · MappingException
param named "property" is required for foreign id generation
Error message
param named "property" is required for foreign id generation strategy
What it means
Error "param named "property" is required for foreign id generation strategy" thrown in hibernate/hibernate-orm.
Source
Thrown at hibernate-core/src/main/java/org/hibernate/id/ForeignGenerator.java:74
/**
* Getter for property 'role'. Role is the {@link #getPropertyName property name} qualified by the
* {@link #getEntityName entity name}.
*
* @return Value for property 'role'.
*/
public String getRole() {
return getEntityName() + '.' + getPropertyName();
}
@Override
public void configure(GeneratorCreationContext creationContext, Properties parameters) throws MappingException {
propertyName = parameters.getProperty( PROPERTY );
entityName = parameters.getProperty( ENTITY_NAME );
generatedType = creationContext.getType().getReturnedClass();
if ( propertyName==null ) {
throw new MappingException( "param named \"property\" is required for foreign id generation strategy" );
}
}
@Override
public Class<?> getGeneratedType() {
return generatedType;
}
@Override
public Object generate(SharedSessionContractImplementor sessionImplementor, Object object) {
return getForeignId( entityName, propertyName, sessionImplementor, object );
}
@Override
public boolean allowAssignedIdentifiers() {
return true;
}
}View on GitHub (pinned to fad1729dce)
Solutions
- Add the 'property' parameter to the @GenericGenerator/@JoinFormula configuration naming the association used for foreign id generation.
When it happens
Trigger: Thrown when a foreign id generator cannot obtain the id from the associated entity.
Common situations: Typical situations: missing 'property' param on the foreign generator; the association is null when the id is generated.
AI-assisted analysis of hibernate/hibernate-orm@fad1729dce (2026-08-22).
Data as JSON: /api/errors/1925f551e31634d8.
Report an issue: GitHub.