0
我有兩個POJO類地址和user_details。 我需要知道如何在代碼運行HashSet在休眠
@ElementCollection
private Set<Address>listOfAddresses = new HashSet();
public Set<Address> getListOfAddresses() {
return listOfAddresses;
}
public void setListOfAddresses(Set<Address> listOfAddresses) {
this.listOfAddresses = listOfAddresses;
}
我在main方法實現爲
Address addr2 = new Address();
addr2.setStreet("Second Street");
addr2.setCity("Second City");
addr2.setState("Second State");
addr2.setPincode("20002");
user.getListOfAddresses().add(addr2);