I have a bidirectional many-to-many class:
public class A{
@ManyToMany(mappedBy=\"listA\")
private List listB;
}
public class B{
@ManyToMany
private
Are you setting both sides of your bidirectional link between A and B correctly? A typically approach is to use defensive methods like this:
public class B {
@ManyToMany
private List<A> listA;
public void addToListA(A a) {
this.listA.add(a);
a.getListB().add(this);
}
public void removeFromListA(A a) {
this.listA.remove(a);
a.getListB().remove(this);
}
}