I have an abstract MappedSuperClass Member, which is extended by three types of Member. Each of them then uses its own "Project", as well as the abstract MappedSuperClass. However, I want the base class to know about projects, so I can write general code to interact with the participants. How to specify this using Hibernate annotations? and how do I redefine it in the ExtendedParticipant and ExtendedProject classes?
Each type of participant and each type of project has its own database tables with existing data and identifiers (not unique to tables) that I cannot change.
The following code gives me an IDE error. "The set to one attribute should not be" Mapped Superclass ".
@MappedSuperclass public abstract class Participant implements Persistable { ... @ManyToOne @JoinColumn(name = "project_id") public Project getProject() { return project; } public void setProject(Project project) { this.project = project; } ... }
and the Project class is similar to the same problem:
@MappedSuperclass public abstract class Project implements Persistable { ... @OneToMany public List<Participant> getParticipants() { return participants; } public void setProject(List<Participant> participants) { this.participants = participants; } ... }
java annotations hibernate
Andrew
source share