我有两个表具有多对多关系
在使这种关系休眠时,将生成一个新的关系表,如何避免使用这个多余的表,而让每个人的ID彼此相同?
Class.java:
@ManyToMany
@JoinTable(name = "STUDENT_TO_MCLASS", joinColumns = @JoinColumn(name = "MCLASS_ID"), inverseJoinColumns = @JoinColumn(name = "STUDENT_ID"))
private Collection<Student> students= new ArrayList<Student>();
Student.java
@ManyToMany(mappedBy= "students")
private Collection<MCLASS> classes= new ArrayList<MCLASS>();