-->
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: Criteria Query : .in() on same object/table
PostPosted: Fri Aug 19, 2005 3:30 pm 
Newbie

Joined: Fri Aug 19, 2005 2:59 pm
Posts: 1
Need help with Hibernate? Read this first:
http://www.hibernate.org/ForumMailingli ... AskForHelp

Hibernate version:
3.0.5

Name and version of the database you are using:
Oracle 9i

I appologize if this is not the correct place to ask for techniques on solving certain kind of querying problems via Hibernate.

I have a collection of Cat (cats). Now I want to create a Criteria Query on Cat, such that, the Criteria Query will limit its search to the collection I have (cats)

Example:

List cats = getCats();
Criteria ct = session.createCriteria(Cat.class)
.add(Restrictions.in("???",cats));

ofcourse, this mechanism doesnt work, as the Cat class doesnt have a reference to itself.

Are there other ways to do this. It looks so simple, but I cant get a query to work :(

thanks everyone,

cheers!


Top
 Profile  
 
 Post subject: Re: Criteria Query : .in() on same object/table
PostPosted: Fri Aug 19, 2005 4:40 pm 
Expert
Expert

Joined: Mon Feb 14, 2005 12:32 pm
Posts: 609
Location: Atlanta, GA - USA
Check out section 11.4.2 Filtering collections in the 3.0.5 reference doc.

_________________
Preston

Please don't forget to give credit if/when you get helpful information.


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.