-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
 Post subject: Help with Detached Criteria
PostPosted: Tue Nov 21, 2006 12:08 pm 
Newbie

Joined: Mon Nov 20, 2006 11:39 am
Posts: 2
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


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.