0
複合キー(address1とaddress2)をマップキーとして与える方法。 @MapKey(name = "address1"、name = "address1")の代わりに@MapKey(name = "address1"、name = "address2"EclipseLink MapKey複合ユニークキー
@Entity
public class Person {
@OneToMany(fetch = FetchType.LAZY, cascade = CascadeType.ALL, mappedBy = "person")
@MapKey(name = "address1")
public Map<String, Address> getAddressMap() {
return addressMap;
}
}
@Entity
public class Address {
private Integer id;
private String address1;
private String address2;
private Person person;
}