I am new to JPA and now run into a problem!
I have two tables Person and PersonAddress .
In the Person object , I have
@OneToMany(mappedBy="personid")
private Set<Personaddress> personaddressCollection;
and
public Set<Personaddress> getPersonaddressCollection() {
return this.personaddressCollection;
}
public void setPersonaddressCollection(Set<Personaddress> personaddressCollection) {
this.personaddressCollection = personaddressCollection;
}
In the PersonAddress object , I have
@ManyToOne
@JoinColumn(name="PERSONID")
private Person personid;
I am making a request similar to the one below:
List<Person> personlist = em.createQuery("SELECT e FROM Person e").getResultList();
I expect it to return all the data from the Person table along with the data in the PersonAddress table in the set available in the Person object. The personlist size is correct, but when I try to read the PersonAddress collection, I get null values. But the database has values in it, and it cannot be null.
PartnerAddress, .
JPA, , , ?
, .