I have a superclass Questions
and its subclass MultipleChoiceQuestions
Superclass has a field activity
I want to create a Set<MultipleChoiceQuestions>
and use OneToMany
annotation using mappedBy = "activity"
e.g.
@OneToMany(fetch = FetchType.EAGER, cascade = CascadeType.ALL, mappedBy = "activity" )
private Set<NQIMultipleChoiceQuestions> mcqQuestions = new HashSet<NQIMultipleChoiceQuestions>();
I am getting this error:
org.hibernate.AnnotationException: mappedBy reference an unknown target entity property
However, it works fine if I create a set of superclass entities,
e.g.
@OneToMany(fetch = FetchType.EAGER, cascade = CascadeType.ALL, mappedBy = "activity")
private Set<NQIQuestions> questions = new HashSet<NQIQuestions>();
Is there a way to map to property of superclass?
Set
. – Disregardful