Hii,
Im wondering if this is the right maner to select by criteria..
my classes:
Code:
public class Person{
private User user;
}
public class User {
private Company company;
...
}
public class Company{
private log companyId;
private String name;
...
}
the criteria is simple:
Code:
DetachedCriteria crit = DetachedCriteria.forClass(Person.class)
.createAlias("user", "u")
.add(Restrictions.eq("u.company.name", "myCompany"))
.setFetchMode("user.company", FetchMode.JOIN);
I get a strange exception..
Code:
org.springframework.orm.hibernate3.HibernateQueryException: could not resolve property: company.name
NB: if I change company.name by company.companyId works!!!
thanks for help!!