I am a novice at using Hibernate and have a question I hope is appropriate to ask in this forum.
I have a entity called person which contains a collection called :
Code:
public class Person {
.
.
.
private Map addresses = new HashMap();
/**
* @hibernate.map cascade="save-update"
* @hibernate.collection-key column="PersonID"
* @hibernate.collection-index column="addressTypeKey" type="string"
* @hibernate.collection-one-to-many class="com.chisq.common.bo.Address"
*/
public Map getAddresses() {
return addresses;
.
.
.
}
public void setAddresses(Map addresses) {
this.addresses = addresses;
}
}
Address looks like this:
Code:
public class Address {
private static final long serialVersionUID=0;
private Long id;
private Pickaddresstype addresstype;
private String city;
private String state;
private String zip;
private Integer priority;
private List addressLines = new ArrayList(4);
private String country;
.
.
.
I've noticed that there is an unmapped column called personid in the address table.
How can I query the person table to find a person a a specific address? Do I somehow use a join on the person and address table?How can I join on personid if it is not a mapped column?