I have an EmployerInfo class which holds a List of ContactPoints. I want Hibernate to treat the ContactPoints as a Set, so I'm using a property annotation to define the mapping, like so:
Code:
@Entity
@Table(name = "general.zjp_employers")
public class EmployerInfo extends PersonInfo{
@Transient
List<ContactPoint> contactPointsList;
@OneToMany(mappedBy="employerInfo")
public Set<ContactPoint> getContactPointsSet() {
return new HashSet<ContactPoint>(contactPointsList);
}
}
However, when I try to run a query on EmployerInfo class, like
Code:
select employerInfo EmployerInfo as employerInfo inner join employerInfo.contactPointsSet as contactPoints where contactPoints.contactInfo = ?
I get "org.hibernate.QueryException: could not resolve property: contactPointsSet of: com.package.EmployerInfo". Can someone please explain what I'm missing here?
Thanks -- Dane