hibernate/hibernate-orm · error · MappingException
Recursive embeddable mapping detected for property '<path>'
Error message
Recursive embeddable mapping detected for property '<path>' of class '<className>'
What it means
Error "Recursive embeddable mapping detected for property '<path>' of class '<className>'" thrown in hibernate/hibernate-orm.
Source
Thrown at hibernate-core/src/main/java/org/hibernate/boot/model/internal/EmbeddableBinder.java:1056
return embeddable;
}
private static boolean isIdentifierMapper(PropertyData inferredData, boolean isIdentifierMapper) {
return isIdentifierMapper && IDENTIFIER_MAPPER_PROPERTY.equals( inferredData.getPropertyName() );
}
private static void checkEmbeddableRecursiveHierarchy(
TypeDetails type,
PropertyData propertyData,
PropertyHolder propertyHolder) {
final var embeddableClass = type.determineRawClass();
while ( propertyHolder.isComponent() ) {
final var componentHolder = (ComponentPropertyHolder) propertyHolder;
// we need to check that the embeddable is not used in a recursive hierarchy
var classDetails = embeddableClass;
while ( classDetails != null ) {
if ( propertyHolder.getClassName().equals( classDetails.getClassName() ) ) {
throw new MappingException( "Recursive embeddable mapping detected for property '"
+ getPath( propertyHolder, propertyData )
+ "' of class '" + propertyHolder.getClassName() + "'" );
}
classDetails = classDetails.getSuperClass();
}
propertyHolder = componentHolder.parent;
}
}
private static void applyColumnNamingPattern(Component embeddable, PropertyData inferredData) {
if ( embeddable.isDynamic() ) {
return;
}
if ( inferredData.getAttributeMember() == null ) {
// generally indicates parts of a plural mapping (element, key, bag-id)
return;
}View on GitHub (pinned to fad1729dce)
Solutions
- Break the recursive @Embedded cycle, e.g. by marking the back-reference @Transient or removing one side of the embedding.
When it happens
Trigger: An @Embeddable / @Embedded / @ElementCollection mapping violates an embeddable mapping constraint.
Common situations: Embeddables with @Id members, inheritance, recursive composition, or properties split across multiple tables; or @Convert/@EmbeddedTable placed where unsupported.
AI-assisted analysis of hibernate/hibernate-orm@fad1729dce (2026-08-22).
Data as JSON: /api/errors/e5f51f3d5ddfa83d.
Report an issue: GitHub.