Hello Hibernate folks,
This is my first posting here, and i hope i'm not being totally noobish with the following question.
I've got the following code:
Code:
Criteria crit = this.getSession().createCriteria(MainClass.class);
The MainClass is linked to other classes (let's call them "MemberClass" -> member name "memberClasses") which themselves contain other classes (let's call them "subClasses" <- member name)
I want to get all MainClass objects which own one or more memberClasses which own one or more subClasses with the id "someRandomId":
Code:
crit = crit.createCriteria("memberClasses").createCriteria("subClasses").add(Restrictions.eq("id", someRandomId));
This one works really well, but it doesn't allow me to add
Code:
crit = crit.createCriteria("memberClasses").createCriteria("subClasses2").add(Restrictions.eq("id", someOtherRandomId));
to the above code because i've already changed the associationPath to "memberClasses->subClasses". Is there a way to get back to "memberClasses" and then go to "memberClasses->subClasses2" or any other way to reach my desired goal? ;)
thanks,
Marc