-->
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.  [ 2 posts ] 
Author Message
 Post subject: Need help with HQL Query or Criteria
PostPosted: Tue Sep 18, 2007 11:21 am 
Beginner
Beginner

Joined: Wed Jul 25, 2007 6:32 am
Posts: 22
How does a query looks that :

Fetches a Category with childCategories and the Items in the childcategories in one single select?

How do I do this in HQL or a Criteria?


Top
 Profile  
 
 Post subject:
PostPosted: Tue Sep 18, 2007 2:18 pm 
Beginner
Beginner

Joined: Fri Sep 08, 2006 7:29 am
Posts: 36
Just a thought....

You would need to join the two tables....

Use Criteria to do this....

Code:
Criteria crit = session.createCriteria(Category.class);

Criteria subCrit = crit.createCriteria("<subCategory Mapping in Category.hbm.xml>");

List results = crit.list();



Explore the objects in the results list. Hope it helps.

Shardul.


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

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.