We're updating the issue view to help you get more done. 

mapped attribute link to the attribute in the embeddable attribute in the referenced entity is not supported

Description

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 @Entity @Audited public class EntityA { ... private EmbA emb; ... } @Embeddable public class EmbA { ... @ManyToMany private List<EntityB> entityBList; ... } @Entity @Audited public class EntityB { ... @ManyToMany(mappedBy = "emb.entityBList") private List<EntityA> entityAList2; ... }

this generate this exception:
org.hibernate.MappingException: Unable to read the mapped by attribute for entityAList2 in EntityA!

After I debug into the source code, I found the problem is here:

1 2 3 4 5 6 7 8 9 10 11 //org.hibernate.envers.configuration.internal.metadata.CollectionMetadataGenerator.java //line: 945 private String searchMappedBy(PersistentClass referencedClass, Table collectionTable) { final Iterator<Property> properties = referencedClass.getPropertyIterator(); while (properties.hasNext()) { final Property property = properties.next(); if (property.getValue() instanceof Collection) { //it skip the embeddable property which may contains relation property. ... } } }

Environment

wildfly 11.0.0.Final

Status

Assignee

Chris Cranford

Reporter

Xj Chen

Fix versions

Labels

None

backPortable

None

Suitable for new contributors

None

Requires Release Note

None

Pull Request

None

backportDecision

None

Components

Affects versions

5.2.12

Priority

Major