How to join list of an entity within other entity and i am getting following error " referenced property unknown" ?
Entity one which is including list of Ghoda:
@Entity
@Table(name = "Case")
public class Case
@Enumerated(EnumType.STRING)
@OneToOne(mappedBy = "case", cascade = CascadeType.ALL, fetch = FetchType.LAZY)
public List<Ghoda> getGhodaHistory() {
return ghodaHistory;
}
public void setGhodaHistory(List<Ghoda> ghodaHistory) {
this.ghodaHistory= ghodaHistory;
}
Entity 2 is Ghoda table itself:
@Entity
@Table(name = "Ghoda")
public class Ghoda{
@OneToOne
@JoinColumn(name = "case_ID")
public Case getCase() {
return case;
}
public void setCase(Case case) {
this.case= case;
}
}
When i try to deploy this then i get following exception:
Caused by: org.hibernate.AnnotationException: Unknown mappedBy in: de.bokla.model.Case.ghodaHistory, referenced property unknown: java.util.List.case
I am not well versed with hibernate and i have created this according to existing code and unable to find where error lies, could anyone suggest how to fix this?