Код: Выделить всё
@Entity
public class Employee {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long id;
@ElementCollection
@CollectionTable(name = "employee_addresses", joinColumns = @JoinColumn(name = "employee_id"))
@Column(name = "address")
private List addresses;
// other fields, getters, and setters
}
Код: Выделить всё
@Embeddable
public class Address {
private String address;
private AddressTypeEnum addressType;
// other fields, getters, setters, constructors
}
Код: Выделить всё
@Entity
public class Employee {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long id;
@ElementCollection
@CollectionTable(name = "employee_addresses", joinColumns = @JoinColumn(name = "employee_id"))
private List addresses;
// other fields, getters, and setters
}
Будем очень признательны за любые рекомендации и предложения. Спасибо!
Подробнее здесь: https://stackoverflow.com/questions/793 ... listcustom