日期:2014-05-17 浏览次数:20616 次
@Entity class Student{ long @ManyToMany Set<Course> courses; } @Entity class Course{ @ManyToMany Set<Student> students; }
Course couse1=new Course(); Course couse2=new Course(); Student student1=new Student(); Student student2=new Student(); student1.setCourses(Arrays.asList(couse1,couse2)); student2.setCourses(Arrays.asList(couse1,couse2));