Hi all,
Currently, I have a many to many relationship between two classes Foo and Bar. In Foo.java, I have the following code in Foo.java:
Code:
private Set<Bar> bars;
@ManyToMany(fetch = FetchType.EAGER)
@JoinTable(
name = "foos_bars"
joinColumns = {@JoinColumn(name = "foo_id")},
inverseJoinColumns = {@JoinColumn(name = "bar_id")}
)
public Set<Bar> getBars() {
return bars;
}
public void setBars(Set<Bar> bars) {
this.bars = bars;
}
Now, I want to make the following changes:
-add a "weight" column to the foos_bars join table so that each Bar associated in a Foo's Set<Bar> can have a weight value.
-replace Set<Bar> instance variable in Foo.java with Map<Bar, Integer> to represent the weight associated with each Bar.
I'm having trouble coming up with the correct annotations to achieve this. Can anyone point me in the right direction?