I have a mapping problem with JPA
@Entity
@Table(name = "TBL_A")
public class EntityA {
// Other mappings
@OneToMany(mappedBy = "entityA")
private List<EntityBImpl> bEntities;
@OneToMany(mappedBy = "entityA")
private List<AnotherEntityBImpl> anotherBEntities;
}
@Entity
@DiscriminatorValue("X")
public class EntityBImpl extends AbstractEntityB {
// Other mappings
}
@Entity
@DiscriminatorValue("Y")
public class AnotherEntityBImpl extends AbstractEntityB {
// Other mappings
}
@Entity
@Table(name = "TBL_B")
@Inheritance(strategy = InheritanceType.SINGLE_TABLE)
@DiscriminatorColumn(name = "PROJ_TYPE")
public abstract class AbstractEntityB {
// Other mappings
@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "ENTITY_A_ID")
private EntityA entityA;
}
It throws the following exception at runtime :
org.hibernate.AnnotationException: mappedBy reference an unknown target entity property: com.example.EntityBImpl.entityA in com.example.EntityA.bEntities
How to solve the problem without having to change the inheritance strategy ?