Please help me, I don't know why many to many is not bidirectional
After room1.getGroups().add(group1) and group2.getAreas().add(room1),
I check to see in what groups is room1 and I get only group1.
thanks for any ideea
serj
Code:
@Entity
public class Room {
private Collection<RoomGroup> groups = new LinkedList<RoomGroup>();
@ManyToMany(cascade={CascadeType.ALL})
public Collection<RoomGroup> getGroups(){
return groups;
}
public void setGroups(Collection<RoomGroup> groups){
this.groups = groups;
}
Code:
@Entity
public class RoomGroup {
....
private Collection<Room> areas = new LinkedList<Room>();
@ManyToMany(mappedBy="groups",cascade={CascadeType.ALL})
public Collection<Room> getAreas(){
return areas;
}
public void setAreas(Collection<Room> areas){
this.areas = areas;
}
}