Hibernate version: 3:0
I am having problems in using Detached queries.
This is the scenario I have
A is the parent class
A has a collection of Bs
B has a collection of Cs
C is a collection of classification objects which is referenced through a Xwalk table.
I am trying to do something like this.
I have a main Criteria created off the parent
mainCriteria = session.createCriteria(A.class,"parent");
DetachedCriteria classes = DetachedCriteria.forClass(Classification.class, "cl")
.add(Restrictions.eq("approved","Pending"));
DetachedCriteria detail = DetachedCriteria.forClass(B.class, "detail")
.add( Property.forName("detail.detailClasses").in(classes));
mainCriteria.add( Subqueries.exists(detail));
I get a Null pointer exception while creating the detail detached Criteria.
Is there anything wrong with this query? Or is there a better way of doing this?
I do not want to join on the child tables because that is affecting my paging functionality. I am interested in doing only subqueries.
Thanks for your help
|