各クエリで完了する、リレーションをCompanyUser.companyRolCompanyUsers
持つプロパティが必要です。OneToMany
JPA company_usrエンティティ:
@Entity
@Table(name = "company_usr")
public class CompanyUser extends BaseModel implements Serializable {
@Id
@ManyToOne(fetch = FetchType.EAGER)
@JoinColumn(nullable = false)
private Company company;
@Id
@ManyToOne(fetch = FetchType.EAGER)
@JoinColumn(name = "usr_id", nullable = false)
private User user;
@Column(nullable = false)
private Boolean external;
@OneToMany(fetch = FetchType.EAGER)
private List<CompanyRolCompanyUser> companyRolCompanyUsers;
....
JPA companyRol_companyUsrエンティティ:
@Entity
@Table(name = "companyRol_companyUsr")
public class CompanyRolCompanyUser extends BaseModel implements Serializable {
@Id
@ManyToOne(fetch = FetchType.EAGER)
@JoinColumns({
@JoinColumn(name="companyuser_company_id", referencedColumnName="company_id"),
@JoinColumn(name="companyuser_usr_id", referencedColumnName="usr_id")
})
private CompanyUser companyUser;
@Id
@ManyToOne(fetch = FetchType.EAGER)
private CompanyRol companyRol;
....
プロパティを正しく設定mappedBy
するにはどうすればよいですか?companyRolCompanyUsers