@ManyToMany bidirectional example:
@Entity
public class EntityA {
@Id
@GeneratedValue
private int myIdA;
@ManyToMany
private List<EntityB> entityBList;
private String strA;
.............
}
@Entity
public class EntityB {
@Id
@GeneratedValue
private int myIdB;
@ManyToMany
private List<EntityA> entityAList;
private String strB;
.............
}
Original Post @ManyToMany with Map values:
@Entity
public class Employee {
@Id
@GeneratedValue
private long id;
private String name;
@ManyToMany
private Map<Date, Task> tasks;
.............
}
@Entity
public class Task {
@Id
@GeneratedValue
private long id;
private String name;
private String description;
.............
}
Original Post