次の図に基づいて、NetBeans (EclipseLink JPA) を使用してエンティティを生成しました。
関連する生成コードは次のとおりです。
Course
@JoinTable(name = "course_software", joinColumns = {
@JoinColumn(name = "course_id", referencedColumnName = "id", nullable = false)}, inverseJoinColumns = {
@JoinColumn(name = "software_id", referencedColumnName = "id", nullable = false)})
@ManyToMany
private List<Software> softwareList;
Software
@ManyToMany(mappedBy = "softwareList")
private List<Course> courseList;
問題はCourse
エンティティにあります。次のように永続化しようとすると
getFacade().create(currentCourse);
currentCourse.setSoftwareList(selectedSoftware);
でレコードが作成されますが、結合テーブルcourse
には何も作成されません。course_software
これはどのように発生し、どうすれば解決できますか?