Farzad,
Thanks for your reply. I am trying to use the custom loader, but having issues.
I am getting "Named SQL query not known" error. When I stepped through the Hibernate source, for some reason it is calling getNamedSQLQuery(), rather than getNamedQuery(). I tried to track down how to trigger it to call getNamedQuery(), but the source path branches way before these calls are made and was a difficult to track down.
Here is my annotated sample:
Code:
public class Department {
private Collection<Employee> topEmployees;
@OneToMany(mappedBy="department", fetch=FetchType.EAGER)
@Loader(namedQuery="topEmployees")
public Collection<Employee> getTopEmployees() {
return topEmployees;
}
}
@NamedQuery(name="topEmployees",
query="select blah blah..." )
//@NamedNativeQuery(...)
public class Employee {
}
What am I doing wrong? Note that if I swith over to NamedNativeQuery, it works.
Using Hibernate 3.2.5 and HibernateAnnotations 3.3.0
Thanks,
jydev