I have a problem with HQL query.
Code:
org.hibernate.QueryException: could not resolve property: classb of: ClassA
This is very simplified model.
Code:
class ClassA{
@Id
private long id;
@ManyToOne(cascade = CascadeType.ALL)
private ClassB classb;
getters();
setters();
}
class ClassB{
@Id
private long id;
private String name;
getters();
setters();
}
I what to have ClassA object list which classb objects have id = 5.
I tried to:
Code:
from ClassA a where a.classb.id = 5;
or
Code:
ClassB classb = ....loadById(5);
from ClassA a where a.classb = classb;
or
Code:
from ClassA a, ClassB b, where a.id = b.id AND b.id=5;
but I want to have a list of ClassA objects, and I dont know what this query returns.
I also tried to DetachedCriteria (I'm using HibernateTemplate) but nothing helps.