I am trying to create a sample Report card application and want to persist a map between subject and student's grade This is my scorecard class:
@Entity
public class ScoreCard {
@NotNull @ElementCollection @ManyToMany(cascade=CascadeType.ALL)
private Map<Subject, String> gradesForMainSubject = new HashMap<Subject, String>();
}
But when trying to save data I always end up with
Caused by: org.hibernate.AnnotationException: Use of @OneToMany or @ManyToMany targeting an unmapped class: gradesForMainSubject
Subject itself is a Managed entity (annotated by @Entity
). Any suggestions on how can I move forward.