こんにちは、みんな、
私はJPAが初めてです。以下のシナリオで問題に直面しています。
以下に示すように、埋め込み可能なクラス ContactInformation があります。
@Embeddable public class ContactInformation {
@OneToMany
private Set<Phone> phoneList;
@Embedded
private Address address;
......
}
以下に示すように、別のエンティティ クラス Employee があります。
@Entity
@IdClass(EmployeeId.class)
public class Employee implements Serializable {
private static final long serialVersionUID = 1L;
@Id
private String id;
@Id
private String name;
@ElementCollection
@CollectionTable(name = "employee_interests")
private Set<String> interests;
//COMPILE TIME ERROR LINE BELOW
@ElementCollection
private Set<ContractInformation> info;
...
}
上記の場合、「マッピングには、禁止されたマッピング "phoneList" を持つ埋め込み可能な "main.ContractInformation" が含まれています。要素コレクションの埋め込み可能なものには、多対 1 または 1 対関係の「所有」側にある必要があり、結合テーブルを使用してはならない 1 つのマッピング"
これを修正する方法を教えてください。
事前に助けてくれてありがとう!!