Hi,
I set up two classes like in the documentation example in section 2.2.5.3.3.1. However, when I have a handle to a child object, the parent relation Set is empty. I do not explicitly set this relation, but expect it to be populated for me.
There is a join table and I use this on the parent side (ReportModel):
@ManyToMany(
targetEntity=mil.darpa.tn.model.EventModel.class,
fetch=FetchType.EAGER,
cascade={CascadeType.PERSIST, CascadeType.MERGE}
)
@JoinTable(
name="reports_events",
joinColumns={@JoinColumn(name="reports_id")},
inverseJoinColumns={@JoinColumn(name="events_id")}
)
public Set<EventModel> getEvents() {
return events;
}
And this on the child side (EventModel):
@ManyToMany(
cascade={CascadeType.PERSIST, CascadeType.MERGE},
mappedBy="events",
targetEntity=mil.darpa.tn.model.ReportModel.class
)
public Set<ReportModel> getReports() {
return reports;
}
I see the join table, but for the child object, its getReports() is always empty when I am expecting it to be filled with inverse relations.
What am I missing?
Thank you!
Darren
|