I have a Hibernate entity, with a getter that is mapped as a @OneToMany:
Code:
@Entity
class Parent extends BaseParent {
@OneToMany(cascade = {CascadeType.ALL}, mappedBy = "parent")
public List<Child> getChildren() {
return super.children;
}
public void setChildren(List<Child> list) {
super.children = list;
}
}
When I try to execute some HQL like:
Code:
select p
from Parent p
left join p.children c
where c.name='foobar'
I get the following exception:
Code:
org.springframework.orm.hibernate3.HibernateQueryException: could not resolve property: children of: ....Parent
If I put the @OneToMany annotation on the protected field, the query works. How can I get this to work such that the annotation can be placed on the getter?